Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

win32 socket error-10055(WSAENOBUFS)!!!

Posted on 2001-07-17
19
Medium Priority
?
3,522 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 200 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

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!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

618 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