Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAsyncSocket help

Status
Not open for further replies.

ss2905

Programmer
Nov 2, 2000
10
JP
Hi All,
I am trying to make a simple application using CAsyncSocket derived class.However, I seem to get stuck at the following points:
1.The Connect function always returns FALSE in SOCK_STREAM mode.The GetLastError() function shows the error as WSAEWOULDBLOCK.I also have a OnConnect handler in my class.However, it is never called.What is happening here?
2.When the Connect function is called for a Socket created with SOCK_DGRAM,the function fails and GetLastError() returns WSAEHOSTUNREACH.
3.The IP Address and Port Number are valid since another application using the same IP and port number executes smoothly.However that uses Windows SOCKET instead of CAsyncSocket class.

Any one having any idea please help me as I am at the end of my project deadline.Any sample application on CAsyncSocket for study is also welcome.

Thanking in Advance,

ss2905 :)
 
Hi ss2905,
i hope i'm not telling any wrong stuff because i haven't done this for a while, so you'd better be warned ;)
ASyncSocket will build a datagram socket, that is not TCP but UDP. And as a connectionless communcation you don't have to call connect.
The procedure for sending/receiving UDP packets is a little different from TCP. Maybe you want to look it up in the VC++ docs, it should be somewhere.

Hope this helps
Christoph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top