Solved

win32 socket error-10055(WSAENOBUFS)!!!

Posted on 2001-07-17
19
3,469 Views
Last Modified: 2012-05-04
When I run my stress test client program overnight, eventually I got this error (10055) when my client program try to reconnect/send data to the server. From the msdn, it says it is "No buffer space available". what caused this and how to prevent this ?
0
Comment
Question by:eugeneng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
  • 2
19 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 6292753
sounds like you are not freeing resources your client uses, are you closing sockets, freeing memory etc etc.

Paul
0
 

Author Comment

by:eugeneng
ID: 6293108
it is tcp/ip connection, so I don't close socket untill the program exit, or when I need to recreate a new one. Do you mean the machine has run out of memory ?
When this error happen, I have to reboot the computer in order to run the client program again.
0
 
LVL 10

Expert Comment

by:makerp
ID: 6293135
it sounds like you are not closing the connections, if your program creates sockets that connects to servers/hosts then you should close the socket after you have finshed then recreate a new one for further connections

pseudo code

loop
  socket = create socket
  connect address
  use socket
  closesocket socket
end loop

if you really must post the code, if its tons then mail it to me paul_maker@hotmail.com, only bother if its VC++ cos thats all i have at the moment, also do not mail me the debug directory
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:eugeneng
ID: 6293169
it is tcp/ip connection, so I don't close socket untill the program exit, or when I need to recreate a new one. Do you mean the machine has run out of memory ?
When this error happen, I have to reboot the computer in order to run the client program again.
0
 
LVL 10

Expert Comment

by:makerp
ID: 6293176
double post
0
 

Author Comment

by:eugeneng
ID: 6293189
it is tcp/ip connection, so I don't close socket untill the program exit, or when I need to recreate a new one. Do you mean the machine has run out of memory ?
When this error happen, I have to reboot the computer in order to run the client program again.
0
 
LVL 10

Expert Comment

by:makerp
ID: 6293194
whats up, stop posting the same comment
0
 

Author Comment

by:eugeneng
ID: 6293195
I didn't do anything, why would this happened ?
0
 
LVL 10

Expert Comment

by:makerp
ID: 6293204
errr, EE mess up, it would not be the first time,

anyway back to the problem in hand,

wnat compiler and OS
0
 

Author Comment

by:eugeneng
ID: 6293227
this is the code I suppose to post,

bool mySocket::Connect()
{
    if (!m_Opened)
     CreateSocket();
      :
      :
     
     if (connect(m_Handle, (sockaddr *) &Address, sizeof(Address)) == SOCKET_ERROR)
     {
           m_SocketError = WSAGetLastError();
            return false;
     }

bool mySocket::CreateSocket()
{
    Close();
    m_hHandle = socket(PF_INET, SOCK_STREAM, 0);
    if (m_hHandle < 0)
    {
     m_SocketError = WSAGetLastError();
        return false;
    }
    m_Open = true;
    return true;
}

void mySocket::Close(void)
{
  if (m_Open)
 {
   shutdown(m_Handle, 2);
   closesocket(m_Handle);
 }
  m_Open = false;
}


this is my to show how do I create, connect, and close the socket, see I close the existing socket whenever I recreate a new one...

0
 

Author Comment

by:eugeneng
ID: 6293232
I'm using VC++ 6.0 on Win2k
0
 
LVL 10

Expert Comment

by:makerp
ID: 6293278
this will fix it, you should always close it before reconnecting or the old connection will not close but just hang around unreferenced

if(m_Opened)
{
 Close();
}
CreateSocket();
0
 

Author Comment

by:eugeneng
ID: 6293295
I'm using VC++ 6.0 on Win2k
0
 

Author Comment

by:eugeneng
ID: 6293319
I'm using VC++ 6.0 on Win2k
0
 

Author Comment

by:eugeneng
ID: 6293322
I'm using VC++ 6.0 on Win2k
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6294711
from http://www.jsiinc.com/SUBB/tip0900/rh0914.htm
....

An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

Not much better.

If you are trying to use an ephemeral (short-lived) TCP port above 5000, this may explain the message. By default, Windows NT 4.0 only supports 5000 ephemeral TCP ports.

You can increase this by navigating to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Add Value name MaxUserPort, a type REG_DWORD, and set it to some decimal number in the range of 5000 - 65534.

Once a port is closed, it takes 4 minutes (240 seconds) before the system will reuse it. You can alter this behavior if you

Add Value name TcpTimedWaitDelay as a type REG_DWORD and set it to some decimal number in the range of 30 - 300 seconds.
....
~ same ideas see in
http://www.proxyplus.cz/faq/articles/EN/art10002.htm

may be it helps...
0
 
LVL 10

Expert Comment

by:makerp
ID: 6294735
alex, could you post me that COM example

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=cplusprog&qid=20150920

cheers

i will put the pts up to 100
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 6304565
eugeneng , did you solved your problem with help
of my comment?
0
 

Author Comment

by:eugeneng
ID: 6306891
sorry, AlexVirochovsky, I was busy with other thing else, I don't know whether your comment will solve my problem but at least you gave me some clue on the problem. thank you any way..
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Arduino EDI - Programming language 3 125
Embarcadero WebBroker REST server endpoint parameters 2 115
print bytes of an integer 6 48
why doesn't assert terminate here? 2 18
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question