#### Archived

This topic is now archived and is closed to further replies.

# Winsock weird error...

This topic is 6367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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

##### Share on other sites
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

##### Share on other sites
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 }

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