i am writing the code for multiuser chat with GUI and i wanna create a quiz game where the all the users i.e the clients can aniticipate in the game. is there a way where we can combine the game and the users together in a single gui screen. the game is on the left box of the gui and chat space on the right.
Using MySQL to store the chat data/users and then recieve the chat data every time the chat table updates because someone entered a new message. I am woundering if this is the right way to do it or should try something else?
What I am looking for is someway to run a query each time the database has been updated or receive data from the database each 10 sec, is it even posible, if yes then how? Been trying to look into threading, but do not seem solve this problem and cant find any information about it.
Me and my brother are working on a small java project to learn network programming and get some experience working with networking code. We decided to make a relatively simple client/server program where clients get into a simple chat lobby and can invite others to play small games(like pong). The basic server code has been written, and we have made a special client that is used for debugging.
We use a self-defined protocol of Strings where a message looks like "4-|user,pass". The number before the delimiter "-|" is the operation code, that tells the server what kind of message this client sends. Based on that number, the server dispatches the message to the appropriate handler method. 4 is authentication for example, and the handler looks the user and pass up in a file and if found, returns true, otherwise, false. Then the server responds to the clinet with 2-|"any message" where the client will recognize opcode 2 as a "authentication accepted" and proceed with the next part of client code. In a similar way, we plan to write all message types(both in the game, in the lobby and in a game setup room).
While testing we ran into a problem where the BufferedReader .readLine() does not seem to be a blocking call like it should be, so the client keeps spamming 'null' in the output field that we made to see the server response to the message we send. When we try to debug the server code and set breakpoints at the suspicious locations, it strangely skips both while(true) loops without activating either breakpoint and executes the finally{} code, even though the client did not close the connection and the second while loop was never entered. The first while loop IS entered though, because the test client gets a "0" on its output, which is the server message indicating "please authenticate yourself".
Also, if we approach things in a dumb way that can be done way more efficiently or easier to read/manage, please do tell. Keep in mind we are beginners though! We decided to use messages in a string format and decode it at both sides as it seemed easier than transmitting java objects and making sure they are of the same type, also for reducing overhead as much of possible. URL....
/** * This is the main server class. It is the core of the server functionality, and the listener for incoming clients that will spawn threads to deal with clients, track their information, change their states and ultimately, clean up after all clients by keeping the data structures up to date.
I am trying to implement the voice chat using java multiCastSocket programming. Taking the input from the microphone and trying to listen it on the speaker. Problem is am not hear any voice back. I debugged through it wireshark and i am receiving the packets from the multicast group address. Looks like there is some problem while i am trying to get the sound out of speaker.
/*Sender Code*/ public class MulticastAudioSender { /** Port to use for IP Multicast sending. */ public static final int IPM_PORT = 7778; /** Address to use for IP Multicast sending. */ public static final String IPM_ADDRESS = "235.1.1.1";
I am trying to make an encrypted video chat program using JMF. I have successfully written the "video chat" part - which includes getting data from webcam and transmitting it using RTP, but how to get raw data video to encrypt it before it stream between the webcam and the network.
For RTP I am using RTPManager, and for reading from the webcam I am using this code:
DataSource ds; CaptureDeviceInfo di = null; StateHelper sh = null;System.out.println("Started Video"); String str1 = "vfw:Logitech USB Video Camera:0"; String str2 = "vfw:Microsoft WDM Image Capture (Win32):0"; String str3 = "vfw:Microsoft WDM Image Capture (Win32):0 : vfw://0";
[Code] .....
I plan on using a stream cipher for encryption, maybe RC4.
I am new to JSP !! and I'm developing a web-based chatting system using JSP and socket.
The problem I am facing is that the sender can send message but on the receiver side we have to manually refresh the page. The sender stays into blocking mode until the receiver refresh its page !
After that I've implemented auto-refresh on the receiver side and "Connection Refused" exception is generated.
how to develop a CHAT APPLICATION using Java springs .this should be very simple client server project with rich front end IT contains login page and a chat page.
I've been trying to create a server/client chat program, but I keep running into areas where I'm not really sure how to work it. I've run into a wall where my client just sits and spins instead of working. URL.... I can work out the dynamic parts later, I just want to understand the meat and potatoes of reading from sockets and writing to sockets (and how to do both at the same time).
So i wrote this text to try and create a simple chat program that does the following: Prepend names to messages, announce entrance and exit of chat, display user list, and share a whiteboard.So far the Server seems to be working but the Chat Client is throwing errors at me left and right..
CURRENT ERROR: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:Windowssystem32>cd.. C:Windows>cd.. C:>Usersjaydesktopchat 'Usersjaydesktopchat' is not recognized as an internal or external command, operable program or batch file.
So for my current work I do a lot of chatting to customers, but I spent 80% of my time answering things that could be automated, I'd like to know where the best place to start would be for the following.
Being able to compile data on certain conversation parts,
for instance "How many employees do you have?/How many people work there?/how many people do you employ" would be a bunch of different ways of saying the same thing, so i could have a stock answer to that: "x employees work at Acme"
So what language and/or framework would be best for having a program like that running, and giving me an alert when it encounters a conversation direction it's not used to, so i can add in an option, so its sort of like I'm teaching at as we go, but I think it's a lot simpler than most AI haha.
Also a way of selecting and reading chat windows, like how old runescape bots used colours.
I'd like do all the data input myself, and I'd like to write or design the framework if possible, but I don't even know what keywords to use find out where I should start.
My task is to create multiuser console chat program. During whole day of poking around , i finally stand on such concept:
1. When running , Server part must stay into while(true) loop and create threads on each ServerSocket.accept() call, providing socket object inside thread. i.e.
while (true){ System.out.println("Waiting for client to connect"); Thread t = new Thread(new Runner(servSocket.accept(),listOfClientSockets)); System.out.println("Starting thread"); t.start(); }
2. Client side always stays within while(true) loop and waiting for user input with ScannerInstance.nextLine() method. As soon as user prints something and hits enter, data being captured from scanner and thrown to socket output stream to the server.
My question is : if all parties (X clients and server) are actually in waiting mode (server is waiting for connections and each client is waiting for user input), who will refresh the screen for each client to draw the messages other parties sent?
At this time , each party see updates only when he hits enter and while loop does next iteration reading data from buffer and displaying on console.
I have developed a window based chat application for chatting, screen sharing, file sharing, video playing.
All are working well on my local network systems (eg. dynamic server ip is 192.168.1.122). But if i try to run on my server (e.g. static server ip 50.62.8.22) it is not get connected..,
I was trying to make a UDP voice chat but i couldn't make the receive method work! so i just move on to work with TCP. I found a simple code that i found it pretty easy to understand,but i couldn't make it work, always stuck within exception.
Here is the output I got:
Available mixers:
Java Sound Audio Engine
Microsoft Sound Mapper
WinOS,waveOut,multi threaded
java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED, 8000.0 Hz, 16 bit, mono, little-endian, audio data
I was a bit confused of the code generated by the Axis2 Code Gen.
I have created a logIn(String username, String password) method in my service and used Axis2 Code Gen to generate the Stub.
I try to access the logIn method from my Client using the Stub like below:
TestServiceStub stub = new TestServiceStub("http://localhost:8080/axis2/services/TestService"); String test = stub.logIn("user","pass").
but instead of UserName and password as the parameters, the Stub created a Login object as the parameter for the logIn method. like the one below:
stub.logIn(Login login1);
I wanted to try the logIn method by providing a static userName and password but it seems impossible because the Stub changed the parameter for the logIn method.
The code here I have works fine if I just want to ask the user to enter four digits: //java application that asks user to input binary numbers(1 or 0) and convert them to decimal numbers import java.util.Scanner; //program uses class scanner public class binarynumber{
//main method that executes the java application public static void main(String args[]){ //declares variables
int digit; int base=2; int degree; double decimal; int binary_zero=0; int binary_one=1; //create scanner for object input
[code]....
The thing is, I want the java application to input more than four digits for the user and I want it to loop it manytimes f until the user ask it to stop.
I need to create a Java program that takes an input a color code in HSV and outputs the equivalent RGB code and Vice versa.
Example: If you test on the color RED in RGB: Input: (255,0,0) Output: (0,100%,100%) If you test on the color RED in HSV: Input0,100%,100%) Output: (255,0,0)
According to what I read, "when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock." (See below for code.)
Why is this? How could making a GUI lead to deadlock?
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }
I have a assignment in which the code has to scrape a web page for a little bit of data including the link to the next page, follow the link, and do this 100 times. It is scraping all the data correctly, including the link, but it isn't following the link to scrape the data on that next page. Instead, it is displaying the first page's data 100 times. I have the code in a while loop where it reads in one character at a time from the page into a string and then uses pattern matching to get the data and the next link from the string. Then it correctly displays the data and should loop back to connect to that next link and read one character at a time into the string and so on.
I have printed the link to the console and it is good. I don't get any errors. I just can't figure out where exactly the problem is. Here is my code:
I have had to create a text analyser. I have created the program but it is all within the main method. The specification states that I have to have at least two methods within my Program.
import java.io.*; import java.text.SimpleDateFormat; import java.util.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; public class Analyser { public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {