C# Socket Error 10042
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 Cortana Bing Application Insights Languages & platforms socket error 10054 Xamarin ASP.NET C++ TypeScript .NET - VB, C#, F# Server Windows Server SQL what is a socket error Server BizTalk Server SharePoint Dynamics Programs & communities Students Startups Forums MSDN Subscriber downloads Sign in Search Microsoft Search Windows socket error 10053 Dev Center Windows Dev Center Explore What’s 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
Socket Error 10054 Connection Reset By Peer
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 new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps socket error 10049 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 topic. The WSAGetLastError function returns the last error that occurred for the calling thread. When a particular Windows Sockets function indicates an error has occurred, this function should be called immediately to retrieve the extended error code for the failing function call. These error codes and a
4, 20042 0 0 0 Remembering numeric error codes is hard. Unless the error handling code is well documented, code reviews take socket error codes linux longer and maintenance is more difficult as you may
Socket Error 10061 Connection Refused
need to consult reference manuals, native code header files or online help frequently.
Socket Error 11001
Socket errors are particularly hard for me to remember. To help myself out, I have collected Windows Sockets error codes into https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx a couple of enums. The first enum, SocketErrorCodes uses friendly descriptions based on the following Microsoft Support article . For detailed descriptions of the error codes, please refer to this article or a Windows Sockets reference.
public enum SocketErrorCodes
{
InterruptedFunctionCall https://blogs.msdn.microsoft.com/davidklinems/2004/11/04/simpifying-socket-exception-handling/ = 10004,
PermissionDenied = 10013,
BadAddress = 10014,
InvalidArgument = 10022,
TooManyOpenFiles = 10024,
ResourceTemporarilyUnavailable = 10035,
OperationNowInProgress = 10036,
OperationAlreadyInProgress = 10037,
SocketOperationOnNonSocket = 10038,
DestinationAddressRequired = 10039,
MessgeTooLong = 10040,
WrongProtocolType = 10041,
BadProtocolOption = 10042,
ProtocolNotSupported = 10043,
SocketTypeNotSupported = 10044,
OperationNotSupported = 10045,
ProtocolFamilyNotSupported = 10046,
AddressFamilyNotSupported = 10047,
AddressInUse = 10048,
AddressNotAvailable = 10049,
NetworkIsDown = 10050,
NetworkIsUnreachable = 10051,
NetworkReset = 10052,
ConnectionAborted = 10053,
ConnectionResetByPeer = 10054,
NoBufferSpaceAvailable = 10055,
AlreadyConnected = 10056,
NotConnected = 10057,
CannotSendAfterShutdown = 10058,
ConnectionTimedOut = 10060,
ConnectionRefused = 10061,
HostIsDown = 10064,<
here for a quick overview of the site Help Center Detailed answers to any questions http://stackoverflow.com/questions/1707214/c-sharp-socket-error-10022 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 http://www.sockets.com/err_lst1.htm 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 socket error a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C# socket error 10022 up vote 1 down vote favorite 1 I have an error 10022 in an application using sockets in C# .NET3.5. In my code, I bind the socket to socket error 10054 the local IP adress. When I don"t need it anymore, I just Disconnect it ( reader.socket.Disconnect(true); ) with "true" to be able to re-use it. But when I call the "bind" method again, it crashes with the 10022 error (invalid argument). If I set the line with this method as a comment, it then crashes on the line "listen", saying that a connection is already set (although I called disconnect !) Any idea? Thanks Here is the part of code which fail : public void WaitConnexion(IPEndPoint localEP) { if (localEP.Port != 9000) { MessageBox.Show("Le port doit être 9000"); return; } LocalEndPoint = localEP; if (reader.socket.Connected) { MessageBox.Show("Vous êtes déjà connecté", "Conflit de connexion", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } // on bind le socket avec le endpoint local, et on le met en attente de connexion asynchrone // reader.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); reader.socket.Bind(localEP); reader.socket.Listen(1); reader.socket.BeginAccept(new AsyncCallback(WaitConnexionCallBack), reader.socket); } and here is the diconnect method with i
short error text for an application to use at runtime to describe a problem to a user. The Windows Sockets API does not have analogs for the Berkeley perror() and herror() functions that take the error value as input, and output the (short) text of each error value (we show the code for an alternative in Chapter 10, "Support Routines"). Since Windows Sockets is practically a clone of Berkeley Sockets, and the rule of thumb is "when in doubt, defer to Berkeley", we can adopt the Berkeley Software Distribution error text as our own. Among other things, that is exactly what we've done here. We took the text of the errno manual page in BSD 4.3, filled in gaps and embellished, completing the information. The Windows Sockets errors are listed in alphabetical order below (they're cross-referenced in a list in numerical order further below). Every error description contains at least: Summary Info: Error macro: manifest constant, as defined in WINSOCK.H Error value: as defined in v1.1 WINSOCK.H Short description Berkeley description: text describing the equivalent BSD 4.3 error value (with some input from other Unix errno values as well). Most of the text comes from the output from the "man errno" command on Unix. WinSock description: a quick comparison to the Berkeley counterpart, and a long description of WinSock error. WinSock functions: the list of functions that explicitly list this error in the v1.1 Windows Sockets specification. Other information varies between different errors. Some of the types of things you will find under some errors are: Microsoft C description: the first few WinSock errors are carry-overs from the standard 'C' runtime library. Typically their descriptions are similar. Detailed descriptions: the specific meanings that some WinSock functions have for some errors. TCP/IP scenario: description of the TCP/IP protocol suite network traffic (i.e. TCP, UDP, ICMP, ARP, DNS) that typically causes the error. Developer suggestions: Things an application developer can do to avoid the error. User suggestions: Things an application user can do to diagnose the error condition further, and/or remedy it. Additional functions: a generic description of the type of functions that can return this error, which may include functions other than those listed by the WinSock specification. It may also make explicit mention of other functions that