Error Binding Port Number To Socket Listening Socket. 10048
Contents |
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 bind error 10048 in ip messenger this site About Us Learn more about Stack Overflow the company Business bind address already in use linux Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask so_reuseaddr 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 error 10048 in sql server WSA error 10048 when binding server sockets up vote 2 down vote favorite I started with the simple server tutorial on the msdn website in order to learn how to use sockets in client and server applications. Once I was done following thet tutorial, I started adapting the client and server code into multithreaded proggrams in order to make a tchat client and
Address Already In Use Mac
server. Everything was going very well until I ran into WSA error 10048. I tried using different ports for each socket but it still did not solve the error. Here is my server code : #undef UNICODE #define WIN32_LEAN_AND_MEAN #include
and both ends must ACK (acknowledge) each other's FIN packets. The FIN packets are initiated by the application performing a close(), a shutdown(), or an exit(). The ACKs are handled by the kernel after the close()
Wsagetlasterror
has completed. Because of this, it is possible for the process to complete before the setsockopt kernel has released the associated network resource, and this port cannot be bound to another process until the kernel has decided that it recvfrom is done. Figure 1 Figure 1 shows all of the possible states that can occur during a normal closure, depending on the order in which things happen. Note that if you initiate closure, there is a TIME_WAIT state http://stackoverflow.com/questions/31912162/wsa-error-10048-when-binding-server-sockets that is absent from the other side. This TIME_WAIT is necessary in case the ACK you sent wasn't received, or in case spurious packets show up for other reasons. I'm really not sure why this state isn't necessary on the other side, when the remote end initiates closure, but this is definitely the case. TIME_WAIT is the state that typically ties up the port for several minutes after the process has completed. The length of the associated http://hea-www.harvard.edu/~fine/Tech/addrinuse.html timeout varies on different operating systems, and may be dynamic on some operating systems, however typical values are in the range of one to four minutes. If both ends send a FIN before either end receives it, both ends will have to go through TIME_WAIT. Normal Closure of Listen Sockets A socket which is listening for connections can be closed immediately if there are no connections pending, and the state proceeds directly to CLOSED. If connections are pending however, FIN_WAIT_1 is entered, and a TIME_WAIT is inevitable. Note that it is impossible to completely guarantee a clean closure here. While you can check the connections using a select() call before closure, a tiny but real possibility exists that a connection could arrive after the select() but before the close(). Abnormal Closure If the remote application dies unexpectedly while the connection is established, the local end will have to initiate closure. In this case TIME_WAIT is unavoidable. If the remote end disappears due to a network failure, or the remote machine reboots (both are rare), the local port will be tied up until each state times out. Worse, some older operating systems do not implement a timeout for FIN_WAIT_2, and it is possible to get stuck there forever, in which case restarting your server could require a reboot. If the local application dies while a connection is active, the por
Studio 2015 products Visual Studio Team Services Visual Studio Code Visual Studio Dev https://msdn.microsoft.com/en-us/library/windows/desktop/ms737550(v=vs.85).aspx Essentials Office Office Word/Excel/PowerPoint Microsoft Graph Outlook OneDrive/Sharepoint Skype https://msdn.microsoft.com/en-us/library/windows/desktop/cc150667(v=vs.85).aspx Services Store Cortana Bing Application Insights Languages & platforms Xamarin ASP.NET C++ TypeScript .NET - VB, C#, F# Server Windows Server SQL Server BizTalk Server SharePoint Dynamics Programs & communities Students Startups Forums MSDN Subscriber downloads error 10048 Sign in Search Microsoft Search Windows 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 Design and UI Develop API reference Publish Monetize error 10048 in 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 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 Windows Sockets 2 Winsock Reference Winsock Functions Winsock Functions bind bind bind accept AcceptEx bind closesocket connect ConnectEx DisconnectEx EnumProtocols freeaddrinfo FreeAddrInfoEx FreeAddrInfoW gai_strerror GetAcceptExSockaddrs GetAddressByName getaddrinfo GetAddrInfoEx GetAddrInfoExCancel GetAddrInfoExOverlappedResult GetAddrInfoW gethostbyaddr gethostbyname gethostname GetHostNameW GetNameByType getnameinfo getipv4sourcefilte
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 Xamarin ASP.NET C++ TypeScript .NET - VB, C#, F# Server Windows Server SQL Server BizTalk Server SharePoint Dynamics Programs & communities 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 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 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 Winsock Reference Socket Options SOL_SOCKET Socket Options SOL_SOCKET Socket Options SO_EXCLUSIVEADDRUSE SO_EXCLUSIVEADDRUSE SO_EXCLUSIVEADDRUSE SO_BSP_STATE SO_CONDITIONAL_ACCEPT SO_EXCLUSIVEADDRUSE SO_KEEPALIVE SO_PORT_SCALABILITY 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. SO_EXCLUSIVEADDRUSE socket option The SO_EXCLUSIVEADDRUSE socket option prevents other sockets from being forcibly bound to the same address and port. Syntax The SO_EXCLUSIVEADDRUSE option prevents other sockets from being