Click here to Skip to main content
15,928,207 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Frustrated with conversion Pin
Christian Graus15-Nov-06 16:44
protectorChristian Graus15-Nov-06 16:44 
AnswerRe: Frustrated with conversion Pin
Raj Prathap15-Nov-06 18:51
Raj Prathap15-Nov-06 18:51 
GeneralRe: Frustrated with conversion Pin
Christian Graus15-Nov-06 19:13
protectorChristian Graus15-Nov-06 19:13 
GeneralRe: Frustrated with conversion Pin
Stick^15-Nov-06 19:44
Stick^15-Nov-06 19:44 
QuestionCreating a DLL Pin
colin_os15-Nov-06 10:38
colin_os15-Nov-06 10:38 
AnswerRe: Creating a DLL Pin
Blake Miller15-Nov-06 10:52
Blake Miller15-Nov-06 10:52 
QuestionCSocket connections Pin
jpyp15-Nov-06 8:53
jpyp15-Nov-06 8:53 
AnswerRe: CSocket connections Pin
Mark Salsbery15-Nov-06 10:19
Mark Salsbery15-Nov-06 10:19 
IMO you left out the most important parts of code in your post - the creation of the sockets.

There's two things going on here, but I can only help with one since you left the rest out.

jpyp wrote:
If QUEUE_SZ is 0, I can connect a 3rd connection but on the 4th, the Connect function returns 0.
If QUEUE_SZ is 1, I can connect a 3rd and a 4th connections but on the 5th, Connect returns 0...and so on.


The backlog parameter of the listen() function sets the maximum number of pending connections.
That's how many connections will sit queued until you accept or refuse them. When the queue
is full, additional incoming connections should be immediately refused.
I'm not sure what the behavior is when you set this to 0. Regardless, since you allow two
simultaneous connections, you might as well set this to at least 2 and refuse connections some
other way.

As for the unknowns, what protocol are you using? How are you creating the sockets?
Assuming TCP then it gets a little tricky rejecting connections with Winsock because of security
issues related to SYN attacks (thank the idiot "hackers").

Based on the code you've shown, I would expect the 3rd client's Connect() call to block until
it times out. If you put a breakpoint on the accept() call in the server, it should only get
called twice with 3 connection attempts, correct?
GeneralRe: CSocket connections Pin
jpyp16-Nov-06 6:05
jpyp16-Nov-06 6:05 
GeneralRe: CSocket connections Pin
Mark Salsbery16-Nov-06 7:08
Mark Salsbery16-Nov-06 7:08 
GeneralRe: CSocket connections Pin
jpyp16-Nov-06 7:30
jpyp16-Nov-06 7:30 
QuestionDetect button three press Pin
Johpoke15-Nov-06 8:33
Johpoke15-Nov-06 8:33 
QuestionRe: Detect button three press Pin
David Crow15-Nov-06 10:01
David Crow15-Nov-06 10:01 
AnswerRe: Detect button three press Pin
Johpoke16-Nov-06 5:32
Johpoke16-Nov-06 5:32 
QuestionRe: Detect button three press Pin
David Crow16-Nov-06 5:39
David Crow16-Nov-06 5:39 
GeneralRe: Detect button three press Pin
Mark Salsbery16-Nov-06 5:55
Mark Salsbery16-Nov-06 5:55 
GeneralRe: Detect button three press Pin
Johpoke16-Nov-06 7:09
Johpoke16-Nov-06 7:09 
GeneralRe: Detect button three press Pin
Mark Salsbery16-Nov-06 7:18
Mark Salsbery16-Nov-06 7:18 
GeneralRe: Detect button three press Pin
Johpoke16-Nov-06 7:23
Johpoke16-Nov-06 7:23 
GeneralRe: Detect button three press Pin
Mark Salsbery16-Nov-06 7:33
Mark Salsbery16-Nov-06 7:33 
GeneralRe: Detect button three press Pin
Johpoke16-Nov-06 8:39
Johpoke16-Nov-06 8:39 
AnswerRe: Detect button three press Pin
PJ Arends15-Nov-06 16:20
professionalPJ Arends15-Nov-06 16:20 
AnswerRe: Detect button three press Pin
Hamid_RT15-Nov-06 18:39
Hamid_RT15-Nov-06 18:39 
QuestionClosing popup dialog window. Pin
xkrja15-Nov-06 7:23
xkrja15-Nov-06 7:23 
AnswerRe: Closing popup dialog window. Pin
Mark Salsbery15-Nov-06 11:23
Mark Salsbery15-Nov-06 11:23 

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.