Advertisement

Winsock weird error...

Started by July 12, 2000 07:28 PM
2 comments, last by Harvester 24 years, 5 months ago
I''m using the CAsyncSocket MFC class. I''ve used it in the past quite some times, and i never had serious problems (except when it crashes a bit after closing it ). Whatever. The error i get is 10038, in other words like MSDN describes (WSAENOTSOCK The descriptor is not a socket.)!!! I''ve used create, before calling the Connect function... Create(); Connect(IP,Port); Then connect return''s 0, which means that it failed, and the error code (GetLastError()), return''s the error i presented above. Any ideas????? PS: I''ve tried telnet the host, and it worked (which means its not a winsock prob., therefore its obviously my fault). Thanks for listening to my screams
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)
I think 10038 is when Winsock can''t find the specified host IP or port, but I may be way out of league here, cuz I used to program Winsock in VB and it was quite a while ago. Still, since you haven''t had any replies yet, make sure the IP and port are valid.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
Advertisement
Error 10038 is defined in WINSOCK.H as this:

#define WSAENOTSOCK (WSABASEERR+38)

WSAENOTSOCK is an indication that the socket you are using hasn't been create()d yet (or, more likely, the create() call failed.)

From the code you wrote, it's hard to tell exactly what it might be. It would help if you posted the lines in question directly from your program... Then we can get a better picture of what's happening.

// CHRIS


Edited by - win32mfc on July 13, 2000 11:17:26 AM
// CHRIS [win32mfc]
The code goes like this...
        if(!MySock.Create()){  AfxMessageBox("Failed1");}else{  MySock.EstablishConnection("127.0.0.1",7000, ...Some_other_params);  if(MySock.rVal_OnConnect==0){    AfxMessageBox("Failed2");    //GetLastError() return's the discussed err code.  }}The code in the EstablishConnection(...) goes like thisvoid ....::EstablishConnection(...){  //Some_other_params managment code...  rVal_OnConnect=Connect(IP,Port);  //as supplied by the given parameter                     //(IP=127.0.0.1  Port= 7000)  //Local error managment code...  return;  //and finally <img src="smile.gif" width=15 height=15 align=middle>}        


If anyone has any ideas???? Its driving me crazy... I've used CAsyncSocket class heavilly in the past, and this time it failes!!! Gosh... what do i do wrong????

Thanks...

Edited by - Harvester on July 13, 2000 2:37:38 PM
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)

This topic is closed to new replies.

Advertisement