![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| p550 connected to a HMC | KeesH | AIX | 4 | 02-13-2007 03:46 AM |
| HMC and Unix Box not connected | KeesH | AIX | 3 | 02-09-2007 12:19 PM |
| SCO connected Monitors | marcelious | SCO | 1 | 06-21-2006 11:24 AM |
| How can I get Information about who is connected??? | Huch | AIX | 3 | 02-23-2006 01:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
Connected or not connected !
Hello !
I've got a question . I really don't het this point. Let's supose that I have a client connected to a server. I want the server IMEDIATLY know if the client is diconnected . How can I realize this ? Amd I'm just curios about one thing. I have a server and multiple clients connected to it. Yes , multithreading . Each client connects to 3 ports on the server. So for each client the server will be opening a socket descriptor .Let's take an example : ( the server is using 3 threads with select , for each socket - 3 ports). Code:
Server will use 3 socket descriptors : 3,4,5 . Client one will use ( the next ) : 6,7,8. Client two will use : 9,10,11 .and so on so fort.. Client three will use : 12,13,14 .. etc.. Good , what do I mean to ask ? How can I know which socket descriptors is using a client ? I mean where do I know client 1 is using : 6 , 7 , 8 ? I mean a problem like this : Client 1 is disconnected . But it only disconnect two sockets from the server , so 6,7 socket descriptors are free , but 8 remain full ( because the clients hasent's disconnected ). So the server ( 3 threads ) with select on each will make the following thing.If another client is connected it will use : 6,7 and the the first free socket descritor in our example if 15. So client 1 will have : 6,7,15 open socket descriptors at server side. I want to know clearly on the server side , which socket descriptors numbers are used by each client. I cannot say that they're always be in a numbered way : n,n+1,n-1 . How can I know . Maybe is a stupid question , but .. Last edited by !_30; 12-29-2006 at 10:31 AM. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
hello !
it is been a long time since u post your problem, so are u having same problems as mentioned ? or solved ? |
|
#3
|
||||
|
||||
|
Same problem.
Which is the solution ? |
|
#4
|
||||
|
||||
|
hello !
ok the solution to this is by means to implement an algorithm -a way- to take care of when the ports will open and when will close, so u will have track all the time of what is going on with the ports. there is no direct way to deal with it. for example in your approach when a peer is connected u open 3 ports, make sure that when it disconnects, it frees up all the ports. no exept. so the u will have your n+1 as u may think there are numerous way to deal with this. so the think u need to do is find "a way" in design lvl rather than digging out functions. Last edited by XinU*; 01-21-2007 at 06:18 PM. |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|