473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to add sockets in select() while waiting?

emibt08
25
I have an application which acts as a server and a client. So, it accepts incoming connections, but also establishes connections. I have a class dedicated to the listening, where the listening sockets reside. Another class establishes connections.

Whether I accept or open a connection, the connected socket goes into another class which does I/O on the connected socket(s). The problem is in this class. I currently use select(), which blocks until something happens on the sockets that are set and I am not sure how to add my new sockets to the fd_set. I could use a timeout value, like 1000ms and add all sockets in my set after the timeout, but i was hoping for a better solution...

I do this on windows, so i was considering the other mechanisms, like overlapped I/O, IOCPs etc, but I don't have much experience with them and I don't see any viable solution to my problem. However, I think that any of the async solutions would be better, but i still don't see anything that solves this.

Maybe my design is just wrong, but any pointer that you can give me would be much appreciated.

Thanks
Feb 5 '10 #1
0 1396

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tero Saarni | last post by:
Hi, I have several threads communicating with each other using events stored in Queues. Threads block on Queue.get() until somebody publishes an event in thread's event queue. I need to add...
4
by: Zunbeltz Izaola | last post by:
Hi I'm porting a client writen in C++ to python. What is the way to get a timeout in an select for one socket? the c++ code is: FD_ZERO(&fds); FD_SET(fd_sock, &fds); tv.tv_sec=2;
0
by: Tom Brown | last post by:
Hi, I created a win32 service for XPPro called N4010ATestService.py (see below). The service runs as a particular user with administrative rights. It starts a thread that creates a simple socket...
1
by: Mohammed Smadi | last post by:
hi; i have the following piece of code: ============= s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind(("",port)) s.sendto(data,(MY_GW,port)) data = s.recvfrom(1024) ============
4
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big...
0
by: Holger Fleckenstein | last post by:
Hi I have written a C++ server and an IDL client, that are supposed to communicate over sockets. Circumstances require, that only one client can connect at a time, and possible others are...
2
by: Stressed Out Developer | last post by:
We have an application that has a 200 count loop that does the following: ' Each time thru the loop we pass the next IP Address is a range (aka 192.168.4.50 thru 192.168.4.254) Try If...
5
by: Dan Ritchie | last post by:
I've got a client/server app that I used to send large amounts of data via UDP to the client. We use it in various scenarios, one of which includes rendering a media file on the client as it is...
6
by: Maxim Veksler | last post by:
Hi, I've written this code, the general idea was to listen on all 65535 port of tcp for connection. """ #!/usr/bin/env python import socket, select def...
0
by: crawfordr | last post by:
Hello, I have created a perl script that connects to a specific socket (Ip address/port) using protocall of TCP. It is the server socket script. There is also coding to manage multiple handles by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.