The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
p550 connected to a HMC KeesH AIX 4 02-13-2007 06:46 AM
HMC and Unix Box not connected KeesH AIX 3 02-09-2007 03:19 PM
SCO connected Monitors marcelious SCO 1 06-21-2006 02:24 PM
How can I get Information about who is connected??? Huch AIX 3 02-23-2006 04:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-29-2006
!_30's Avatar
!_30 !_30 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Romania
Posts: 37
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..
If , per example client 1 is disconnected ( from all 3 sockets ) , select from server ( all 3 threads ) will connect another client on : 6,7,8 , because they're free..

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 01:31 PM..
  #2 (permalink)  
Old 01-21-2007
XinU*'s Avatar
XinU* XinU* is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 15
hello !
it is been a long time since u post your problem, so are u having same problems as mentioned ? or solved ? if not it might be a solution.
  #3 (permalink)  
Old 01-21-2007
!_30's Avatar
!_30 !_30 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Romania
Posts: 37
Same problem.

Which is the solution ? ( You were talking about ? ).
  #4 (permalink)  
Old 01-21-2007
XinU*'s Avatar
XinU* XinU* is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 15
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 09:18 PM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0