Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Allocating Mulitple Sockets

Posted on 1998-12-27
8
Medium Priority
?
224 Views
Last Modified: 2010-04-02
I am having a problem allocating multiples sockets using win98, and Visual C++ 5.0.  I am using the CAsyncSocket class.  The problem is I get the WASENOBUFS error message after allocating about 255 sockets.  I have tried the solutions by JHance, can anyone else give something that will work?
0
Comment
Question by:Fredbarnes
  • 5
  • 3
8 Comments
 

Author Comment

by:Fredbarnes
ID: 1181114
I have searched high and low for this solution. I am losing hair, and dreaming sockets. Can anyone help? An alternative question is how can I us CAsyncSocket to listen on ALL ports for incoming connections or requests? Is there a way that I can rotate the allocated listening ports to listen on other ports in the background?  JHance? Anyone?
0
 

Author Comment

by:Fredbarnes
ID: 1181115
Adjusted points to 75
0
 

Accepted Solution

by:
dmcreyno earned 210 total points
ID: 1181116
The system is out of buffers for sockets. You have hit the OS limit. Many operating systems place a cap on the number of sockets a process may own. 255 is a popular number.
0
Industry Leaders: 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:Fredbarnes
ID: 1181117
I appreciate your answer, and it is decent, however, I would like to know if there is any code available to alternate the 255 sockets, so that I may listen on all ports?  If so, please respond?
0
 

Expert Comment

by:dmcreyno
ID: 1181118
Just out of curiosity, how much memory does this box have? I have compiled a small test app that I got to open 3975 CAsyncSockets. All I do is call Create(). What are your args to Create() so that I might duplicate your lower number?
0
 

Expert Comment

by:dmcreyno
ID: 1181119
Just out of curiosity, how much memory does this box have? I have compiled a small test app that I got to open 3975 CAsyncSockets before I get the WSAENOBUFS. All I do is call Create(). What are your args to Create() so that I might duplicate your lower number? I even had trouble submitting this update while the test app was running. Netscape complained that there were no more sockets.

What are you building that you need to listen to ALL ports. From my own personal experience some OSes will not let you bind below 1024.
0
 

Author Comment

by:Fredbarnes
ID: 1181120
The code I am using is:
int i=1024;
CMySocket* pSocket[65536];

while(i++ <= 65535)
{
 pSocket[i]=new CMySocket;
 if(!pSocket[i]);
{
 MessageBeep(0);
}
//otherwise create the socket;
if(! pSocket[i]->Create(i))
{int err= WSAEGetLastError();
 //print out the error code here.
}
//otherwise listen on that port

//and add the port to CTypedPtrArray structure.
}



0
 

Author Comment

by:Fredbarnes
ID: 1181121
What I am working on is a Proggie called "SneakyPete".  SneakyPete will listen on all ports for incoming requests, while running other apps, like: AIM, AOL, and also Web programs like the IGZ (Internet Gaming Zone).  When IM's are sent, I would like to b able to retrieve the senders IP. It is a security type application.  I have 64 megs of ram (EDO) in the system, it is a 166mmx system In addition, I have lots of devices like cams, DVD, Radio, TV, Scanners... hooked up. If u can help, it would b greatly appreciated.  I am now putting together an old piece of machinery to test on that.  If I get more, then I will reset this system with 255 socket limitation.
Thank you much for your help!
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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

876 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