Click here to Skip to main content
       

ATL / WTL / STL

 
JokeRe: get instance of object (in exe) from dll caller Pinmemberpasztorpisti17-Sep-12 14:43 
GeneralRe: get instance of object (in exe) from dll caller Pinmemberpasztorpisti17-Sep-12 14:48 
AnswerRe: get instance of object (in exe) from dll caller PinmvpRichard MacCutchan17-Sep-12 23:16 
AnswerRe: get instance of object (in exe) from dll caller PinmemberStephen Hewitt18-Sep-12 19:49 
QuestionCAsyncSocket Connect says in use Pinmemberbkelly1316-Sep-12 7:07 
Answerunexpected behavior [modified] Pinmemberbkelly1316-Sep-12 11:07 
AnswerRe: CAsyncSocket Connect says in use PinmemberRichard Andrew x6416-Sep-12 12:53 
AnswerRe: CAsyncSocket Connect says in use Pinmemberpasztorpisti16-Sep-12 13:05 
Well, I've done some TCP socket programming in the past but haven't used the CAsyncSocket class. What is interesting for me is that listen() returns EWOULDBLOCK for you. listen() should never return EWOULDBLOCK if you take a look at its documentation. listen() is always blocking but only for a very short time, it either returns failure or does its job (establises incoming connection request queue, the backlog) and returns with success.
So whats wrong with your code? Here is my guess: After starting the listen you unnecessarily issue some other request on your listen socket (for example an accept() call) and that results in a WSAEWOULDBLOCK message that is not still not the end of the world, but strange and you should check out the reason for this. About the WSAEADDRINUSE problem: If your listening starts as expected then it allocates and uses a port on your machine. When you connect the client side should issue a connect() call that results in the following events: your server side receives an event and as a result calls accept(). Both the server side accept() call and the client side connect() call returns a socket that has random ports assigned. HOWEVER: If your misterious CAsyncSocket class calls bind() before the connect() call, then it will fix the port of the returned socket by the connect() call and if that is the same as the port on which your server is listening then the socket can not be created on the client side! You should make sure that bind isn't called before connect() allowing the connect() call to assign a random port for the client side socket! bind() is usually used before connect when your firewall allows only specific ports for the software to communicate.
Another side note: WSAEADDRINUSE might return if you shut down your program during debugging. In this case some of your sockets might stay alive inside the network subsystem because of lingering. In this case sometimes you have to wait for minutes for that socket object to diminish from the network subsystem so as to release your ports.
GeneralRe: CAsyncSocket Connect says in use Pinmemberbkelly1316-Sep-12 13:55 
GeneralRe: CAsyncSocket Connect says in use Pinmemberpasztorpisti16-Sep-12 14:09 
GeneralRe: CAsyncSocket Connect says in use Pinmemberbkelly1316-Sep-12 14:17 
GeneralRe: CAsyncSocket Connect says in use Pinmemberpasztorpisti16-Sep-12 14:34 
GeneralRe: CAsyncSocket Connect says in use [modified] Pinmemberbkelly1316-Sep-12 15:07 
Questionbetter version of strcpy() and printf() Pinmemberbkelly1315-Sep-12 11:02 
AnswerRe: better version of strcpy() and printf() PinmentorPaul Watt15-Sep-12 13:33 
GeneralRe: better version of strcpy() and printf() Pinmemberbkelly1315-Sep-12 16:34 
GeneralRe: better version of strcpy() and printf() PinmentorPaul Watt15-Sep-12 16:45 
GeneralRe: better version of strcpy() and printf() Pinmemberbkelly1315-Sep-12 17:23 
GeneralRe: better version of strcpy() and printf() Pinmemberpasztorpisti16-Sep-12 7:54 
GeneralRe: better version of strcpy() and printf() PinmvpRichard MacCutchan16-Sep-12 1:10 
AnswerRe: better version of strcpy() and printf() PinmemberRichard Andrew x6415-Sep-12 18:01 
AnswerRe: better version of strcpy() and printf() PinmvpRichard MacCutchan16-Sep-12 1:09 
AnswerRe: better version of strcpy() and printf() Pinmemberpasztorpisti16-Sep-12 2:37 
AnswerRe: better version of strcpy() and printf() PinmemberStephen Hewitt18-Sep-12 1:29 
Questionget a number into static text control Pinmemberbkelly1313-Sep-12 18:05 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 15 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid