Error - Socket Error 10038
Contents |
Studio 2015 products Visual Studio Team Services Visual Studio Code Visual Studio Dev Essentials Office Office Word/Excel/PowerPoint Microsoft Graph Outlook OneDrive/Sharepoint Skype Services Store socket error 10054 Cortana Bing Application Insights Languages & platforms Xamarin ASP.NET C++ TypeScript
Socket Error 10057
.NET - VB, C#, F# Server Windows Server SQL Server BizTalk Server SharePoint Dynamics Programs & communities
Socket Error 10061
Students Startups Forums MSDN Subscriber downloads Sign in Search Microsoft Search Windows Dev Center Windows Dev Center Explore What’s new for Windows 10 Intro to Universal Windows Platform
Socket Error 10038 Socket Operation On Non Socket
Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI Develop API reference Publish Monetize Promote Games Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Explore What’s socket error 10035 new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI Develop API reference Publish Monetize Promote Games Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Networking and Internet Windows Sockets 2 Winsock Reference Winsock Reference Windows Sockets Error Codes Windows Sockets Error Codes Windows Sockets Error Codes Socket Options Winsock IOCTLs Winsock Annexes Winsock Enumerations Winsock Functions Winsock Structures and Typedefs Winsock Tracing Events Winsock SPI Windows Sockets Error Codes TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Windows Sockets Error Codes Most Windows Sockets 2 functions do not return the specific cause of an error when the function returns. For information, see the Handling Winsock Errors
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with socket error 10053 us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow winsock error 10038 Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 10038 what is a socket error socket error up vote 3 down vote favorite 1 Is there any solution for 10038 server error .i have done coding in c++; the server runs fine 10 to 12 hours but sudenly it gives 10038 socket error c++ visual-c++ sockets share|improve https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx this question edited Oct 16 '10 at 9:00 asked Oct 16 '10 at 8:32 SunilRai86 34231025 add a comment| 3 Answers 3 active oldest votes up vote 6 down vote Without seeing your code: the symptom you describe sounds like you are leaking memory/resources, i.e. you are forgetting to free/delete objects you are allocating. It could also be a timing issue. I suggest you post your (cut-down) code. 10038 (WSAENOTSOCK): Socket operation on nonsocket. An operation was attempted on something that is not a http://stackoverflow.com/questions/3948164/10038-socket-error socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid. share|improve this answer answered Oct 16 '10 at 8:34 Mitch Wheat 215k28345442 1 downvoters please leave a comment. –Mitch Wheat Jan 30 at 0:00 Can you explain the cryptic: "An operation was attempted on something that is not a socket" –Silvester Aug 11 at 8:53 add a comment| up vote 6 down vote I bet you are accessing a socket that you already closed. This is a very common timing bug in WinSock programming - the good news (and bad news, because it's hard to reproduce) is that you are not hitting it very often so it's likely your code does not need much work to make it perfect. I think you should add thread-safe diagnostics that output a string including the socket value (an int, basically) on every open and close, and from anywhere you see this 10038 or other unexpected errors. If you can add those diagnostics and then set up a stress test that focuses on open and close areas in your program (you may need to strip down the code to a small subset for unit testing of the sockets handling, maybe doing this back-to-back on localhost, or to two LAN-connected machines) then it will likely manifest much more quickly than 10-12 hours and you may find and fix other timing windows along the way. The goal is to try to comp
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about http://stackoverflow.com/questions/577780/send-returns-winsock-error-10038 Stack Overflow the company Business Learn more about hiring developers or posting ads with http://stackoverflow.com/questions/15504016/c-winsock-socket-error-10038-wsaenotsock us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up send(), returns Winsock Error 10038 up vote 0 down vote favorite Problem: Call to socket error send(), returns Winsock Error 10038 against socket handle Illustration: acceptedSocket = accept (server, (sockaddr *)&sin, &len); accept(), returns 0 A new thread, is created for each connection send(), (in thread function) returns 10038 Illustration: - in thread function //omitted SOCKET RemoteSocket = (SOCKET) client; //omitted send (RemoteSocket, stringToSpend, strlen(stringToSpend), 0) Suggestions: Possible, race condition? Could use I/O completion ports, but not at this stage c++ windows visual-studio-2008 multithreading winsock share|improve socket error 10038 this question edited Feb 23 '09 at 15:00 asked Feb 23 '09 at 14:23 Aaron 1,36253352 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote accepted Isn't the problem in the line acceptedSocket = accept (server, (sockaddr *)&sin, &len) == INVALID_SOCKET) You make acceptedSocket the result of the comparison, but you should store the actual socket returned from accept somehow: acceptedSocket = accept (server, (sockaddr *)&sin, &len); isOK= acceptedSocket!=INVALID_SOCKET; Although I'm a bit confused by the unbalanced parentheses in your post, so I may be wrong share|improve this answer answered Feb 23 '09 at 14:52 jpalecek 36.5k365112 add a comment| up vote 2 down vote accept() returns you a handle to a new connection-specific socket. for server code it's 2+ sockets involved: one is in listen state you are calling accept() for and second is one returned from accept() - it's an incoming connection socket. Following accept() can return socket for second incoming connection etc. if accept() returns 0 it's not an incoming connection - it's an error. share|improve this answer answered Feb 23 '09 at 14:43 Eye of Hell 6,88331114214 One correction: accept returning 0 is a normal (successful) execution. Errors are signalized by -1 –jpalecek Feb 23 '09 at
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C++ Winsock Socket Error: 10038 (WSAENOTSOCK) up vote 4 down vote favorite 1 I have an master slave application Master running on WinXp(i7, 2.1 Ghz) and slave being a controller board. The master sends request to the slave and the slave in response send to the master the data cyclically. This data send cyclically by the slave is 1000 bytes per 0.5 msec. When the masters makes the request to send the data, on the console an error is reported. " Select() function error code:: 10038 ". This is the code for WSAENOTSOCK. This application is a single threaded application receiving the data from the slave. As from the error it seems that the socket is closed before it is checked by the select function. Can any one please point me in the direction ? :::Source Code:::: int Receive() { int rc; socklen_t cli_alen; struct timeval to; fd_set read_fd, write_fd, excep_fd; FD_ZERO(&write_fd); FD_ZERO(&excep_fd); sock_again: if (!_isSocketOpen) { return 0; } FD_ZERO(&read_fd); FD_SET(_sock_fd, &read_fd); to.tv_sec = 0; to.tv_usec = 0; cli_alen = sizeof(SOCKADDR_IN); rc = select(_sock_fd+1, &read_fd, &write_fd, &excep_fd, &to); if (rc == 0 ) { // Timeout // printf("XCP Port %d : select() timded out \n", _port); acess = 1; goto sock_again; } else if (rc == SOCKET_ERROR) { // Error LogError("XCP: select() error %d", WSAGetLastError()); closesocket(_sock_fd); return -1; } else { // Data if (!FD_ISSET(_sock_fd, &read_fd)) { LogError("XCP: select() wrong socket descr"); return -1; } else { //read data rc = recvfrom(_sock_fd, (char *)_recvBuf, UDP_RECVBUFLEN, 0, (LPSOCKADDR)&_saddr, &cli_alen); } } } :::: Edited :::: int CloseUdpConnection() { if (closesocket(_sock_f