Click here to Skip to main content
16,010,650 members
Home / Discussions / Java
   

Java

 
QuestionFTI Messenger Pin
noor1007-Aug-12 2:53
noor1007-Aug-12 2:53 
AnswerRe: FTI Messenger Pin
TorstenH.7-Aug-12 5:13
TorstenH.7-Aug-12 5:13 
AnswerRe: FTI Messenger Pin
Joan M11-Aug-12 3:38
professionalJoan M11-Aug-12 3:38 
Generalsynchronization validation and display of dialog in a primeface JSF2.0 form Pin
ahmadiss7-Aug-12 2:42
ahmadiss7-Aug-12 2:42 
QuestionChat Server Issue Pin
Joshua Waring6-Aug-12 3:37
Joshua Waring6-Aug-12 3:37 
GeneralRe: Chat Server Issue Pin
pasztorpisti6-Aug-12 5:03
pasztorpisti6-Aug-12 5:03 
GeneralRe: Chat Server Issue Pin
Joshua Waring6-Aug-12 5:33
Joshua Waring6-Aug-12 5:33 
GeneralRe: Chat Server Issue Pin
pasztorpisti6-Aug-12 6:22
pasztorpisti6-Aug-12 6:22 
I detailed a solution/workaround with blocking sockets. Nonblocking sockets is a bit more complicated so search for a good tutorial if you want to learn it. In my workaround solution there is one thread per user, and 1 thread to accept new users. As I described in the solution the user thread sends the incoming messages to the user and then receives the message of the user. It does send some kind of data periodically (every half/one sec) even if there are no incoming messages or message sent by the user. The thread should have an array for incoming messages into which other user threads can put incoming messages. lets say a user thread receives a message from the user - in this case the user thread iterates over the other users and puts this message to their incoming message queue. The other user threads will send this message out to other clients when their thread gets into the state of "sending out incoming messages". You have to use locks on data structures that are used by multiple threads, for example on the list of users. This list is used by both the accept threads and the user threads. You also need to use a lock on the incoming message queue of user threads because it is accessed by both the user thread and other user threads who put messages to it.
AnswerRe: Chat Server Issue Pin
BobJanova6-Aug-12 5:23
BobJanova6-Aug-12 5:23 
GeneralRe: Chat Server Issue Pin
pasztorpisti6-Aug-12 6:29
pasztorpisti6-Aug-12 6:29 
GeneralRe: Chat Server Issue Pin
Member 93392916-Aug-12 16:11
Member 93392916-Aug-12 16:11 
GeneralRe: Chat Server Issue Pin
pasztorpisti6-Aug-12 19:55
pasztorpisti6-Aug-12 19:55 
GeneralRe: Chat Server Issue Pin
Joshua Waring7-Aug-12 0:17
Joshua Waring7-Aug-12 0:17 
GeneralRe: Chat Server Issue Pin
pasztorpisti7-Aug-12 0:23
pasztorpisti7-Aug-12 0:23 
GeneralRe: Chat Server Issue Pin
Joshua Waring7-Aug-12 1:07
Joshua Waring7-Aug-12 1:07 
GeneralRe: Chat Server Issue Pin
pasztorpisti7-Aug-12 1:42
pasztorpisti7-Aug-12 1:42 
GeneralRe: Chat Server Issue Pin
Joshua Waring8-Aug-12 0:10
Joshua Waring8-Aug-12 0:10 
GeneralRe: Chat Server Issue Pin
pasztorpisti7-Aug-12 0:52
pasztorpisti7-Aug-12 0:52 
GeneralRe: Chat Server Issue Pin
Joshua Waring7-Aug-12 1:57
Joshua Waring7-Aug-12 1:57 
GeneralRe: Chat Server Issue Pin
pasztorpisti7-Aug-12 2:33
pasztorpisti7-Aug-12 2:33 
GeneralRe: Chat Server Issue Pin
Joshua Waring7-Aug-12 3:18
Joshua Waring7-Aug-12 3:18 
GeneralRe: Chat Server Issue Pin
pasztorpisti7-Aug-12 3:50
pasztorpisti7-Aug-12 3:50 
Questionplease help Pin
Mohammed Kherfan5-Aug-12 0:25
Mohammed Kherfan5-Aug-12 0:25 
AnswerRe: please help Pin
Richard MacCutchan5-Aug-12 1:21
mveRichard MacCutchan5-Aug-12 1:21 
AnswerRe: please help Pin
wo_buhui6-Aug-12 23:18
wo_buhui6-Aug-12 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.