473,659 Members | 2,944 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sockets - how to listen on multiple ports

Hi
I am writing a simple server to monitor ports. The problem is I don't know
how to make it listen on multiple ports. It creates the first socket,
listens, than accepts and of course the accept call blocks, so it does not
return to create socket for the other ports. I am doing this in windows, so
using 'fcntl' to do non blocking won't work.
Any suggestions? I can paste the code if need be.

Thanks
Jul 19 '05 #1
1 4837
In article <0f************ ********@comcas t.com>, Jim Kipp
<jk****@comcast .net> wrote:
Hi
I am writing a simple server to monitor ports. The problem is I don't know
how to make it listen on multiple ports. It creates the first socket,
listens, than accepts and of course the accept call blocks, so it does not
return to create socket for the other ports. I am doing this in windows, so
using 'fcntl' to do non blocking won't work.
Any suggestions? I can paste the code if need be.

Thanks


Under Unix, you would use the select function, or the OO
interface-to-select IO::Select. Hopefully, these work under windows. In
particular, see "perldoc IO::Select" for an example of how to monitor
input from several sockets.

FYI: this newsgroup is defunct. Try comp.lang.perl. misc in the future.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1641
by: Dmitry Akselrod | last post by:
Sockets Programming Question: I have two applications. One is a server, one is a client. However, both listen on certain ports for communication. The server is written in vb.net (framework v.1.0) and the client is written in vb6 sp5 because vb6 uses far less resources.
4
2160
by: 0to60 | last post by:
I have a question about socket programming in general. Exactly what happens behind the scenes when I one socket connects to a different socket in listen mode? Using the dotnet framework, I create a socket, bind it to a port, put it in listen mode, and then n sockets can connect to it. The code: Socket newSocket = listeningSocket.Accept(); returns a socket. I can communicate on newSocket, and listeningSocket goes
7
1422
by: Steven | last post by:
Hi, Thanks all for you help with my "socket and buffer size" question. I have decided to use async ones, and my code is working pretty well. But i still have a non-answered question: Is it a problem if all the client are connected and sending a large quantity of bytes simultaneously to the same port of the server ?
0
1856
by: Valleriani | last post by:
Right Now I've been working on a text based game for fun. It was working fine but they I relized that you need to shut/close the ports. Before I was just opening ports and not shutting them, no problems because it will just go to the next port. But this way is not correct. I started shutting the ports but now I get the error of the 'user' not being in the correct socket when its checking etc. For example: User 1 logs in, user 2 logs in as well....
2
7108
by: jasonsgeiger | last post by:
From: "Factor" <jasonsgeiger@gmail.com> Newsgroups: microsoft.public.in.csharp Subject: Multiple Clients, One port Date: Wed, 19 Apr 2006 09:36:02 -0700 I'm been working with sockets for a short while now using a server program a former coworker started. The program listens on a port for incomming connections. When a valid connection is made (we send this init string into the socket from the clients) the server closes the socket so...
1
15621
by: verge | last post by:
hello everyone! how's it going? like everyone in here im in need of some help and good friendship along the way...take a look at this: //MODIFIED SO IT DEALS WITH WINDOWS FTP USING ACTIVE CONNECTION //IMPORTANT: the logic is NOT complete, the program works only once and disconnects or freeze //One needs to modify or rewrite the program so it is fully functional for LIST and RETR
5
1275
by: Mark | last post by:
I am working on a Windows service application that will listen on multiple IPs and ports e.g. port 25, 110 etc. As far as I could see the EndPoint only contains one IP and a port. How is it possible to listen on multiple IPs and multiple ports of an IP? Would there be separate socket for each combination of IP and ports? Also, what is the best way for coding a listener -- an indefinite loop, or there could be any other better way to do this?...
2
1063
by: Abubakar | last post by:
Hi, I'm working on a sockets app (using all those connect, socket, recv, send stuff). There is one problem on just one of many pcs i deal with. This pc, sometimes my app crashes on it, which is pretty usual cuz of application bugs and I fix them of course. But the problem is that the ports r left open when the app crashes. I see the list from entering the *netstat -a -o* command at the command prompt. Its shows that the ports r still in...
1
3629
by: jcprince | last post by:
Hi Not sure I can do what I'm trying to do without using a 3rd party component like Dart. I need to build a windows service to create a socket connection on an IBM mainframe using an IP and port combination. No problem there. However, due to the expected volume (at least 20x10K streams per second in each direction), the mainframe sysadmin has requested the service use multiple 'conversations' within the single IP connection. The...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.