Sponsored Content
Full Discussion: Connected or not connected !
Top Forums Programming Connected or not connected ! Post 302101232 by !_30 on Friday 29th of December 2006 10:02:26 AM
Old 12-29-2006
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 ? Smilie

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 .. Smilie

Last edited by !_30; 12-29-2006 at 01:31 PM..
 

10 More Discussions You Might Find Interesting

1. AIX

How can I get Information about who is connected???

Hello, I'm new here and I come from Germany. At our AIX-ORACLE-System someone has deleted one important file and we'd like to find out who did this, next time. Is there any command to find out who is connected? I'm not trying to find out if it's root, etc., I'd like to get the DNS-Name or... (3 Replies)
Discussion started by: Huch
3 Replies

2. SCO

SCO connected Monitors

Hi all, we have 5 monitors connected to a SCO server using it's IP address(192.168.1.1), the server got busted, we have another similar server to connect the monitors to , how can i change the IP address of the new server to be (192.168.1.1), and connect the monitors to it. thanks, Marcel (1 Reply)
Discussion started by: marcelious
1 Replies

3. AIX

p550 connected to a HMC

Morning, I've installed a new p550 into a rack and connected it up to the HMC but the HMC cannot find it, I don't understand why it's not? Has anyone else had this problem before? Thanks Kees (4 Replies)
Discussion started by: KeesH
4 Replies

4. IP Networking

check whether connected to network

hi... can anyone pls suggest a few methods to check whether a computer is connected to any network, using the terminal, not GUI. thanks eskay (1 Reply)
Discussion started by: eskay_karthik
1 Replies

5. UNIX for Advanced & Expert Users

linux connected to as400

we have a as400 5rev4 and want to use a rhel server to use as a file server. We exported a drive on the rhel box and then mounted it on the as400. We can see the top directory in our mounted as400 directory but when we attempt access subdirectories we get a no matching object error. When we open... (2 Replies)
Discussion started by: javagair
2 Replies

6. AIX

How do I know to which storage I am connected

Hello everyone. We have a environment where we have DS8K storage and ES800 storage, the way to check to which storage the box is connected is using the LUN ID I get frm " pcmpath query device " command. for ex: 75CXX - DS8K storage 26860 - ES 800 Storage I was told to check... (4 Replies)
Discussion started by: nivaspIND
4 Replies

7. IP Networking

Am I Connected?

Be Gentle folks, I am a baby OpenSuSe 11.2 user :-) In windows Vista, there is a world in the systray when you are Internet connected and not just local. I have searched all over for a .RPM for the Network Manager or another packeg in Suse that can show me the same thing or something close. ... (0 Replies)
Discussion started by: donmaxwelliii
0 Replies

8. Shell Programming and Scripting

Mysql is not connected in php

Hi, The php is not able to connect into my mysql database. But i can able to connect by manually. I think that I have missed some points. Please guild for the same. Thanks, Mani (1 Reply)
Discussion started by: Mani_apr08
1 Replies

9. UNIX for Dummies Questions & Answers

Non Internet connected distribution

Hi all I've been a Debian user since solidly since about 1997 so I'm fairly experienced Linux user as a whole but unfortunately the monoculture has hit be hard recently. I'm working off a Laptop a lot of the time which spends up to 2-4 weeks without an Internet connection. A few weeks ago it... (1 Reply)
Discussion started by: pointyhat
1 Replies

10. IP Networking

Connected to IANA anyway, why?

May someone can answer this. Anytime I ignite my laptop to go online I see via etherape that I am connected to IANA as shown below. Is my provider redirecting me there, the cable under the sea, what is the reason for this? This happened with a pretty normal desktop PC, as well with my ancient... (2 Replies)
Discussion started by: 1in10
2 Replies
Server::Client(3pm)					User Contributed Perl Documentation				       Server::Client(3pm)

NAME
Net::SMTP::Server::Client - Client session handling for Net::SMTP::Server. SYNOPSIS
use Carp; use Net::SMTP::Server; use Net::SMTP::Server::Client; use Net::SMTP::Server::Relay; $server = new Net::SMTP::Server('localhost', 25) || croak("Unable to handle client connection: $! "); while($conn = $server->accept()) { # We can perform all sorts of checks here for spammers, ACLs, # and other useful stuff to check on a connection. # Handle the client's connection and spawn off a new parser. # This can/should be a fork() or a new thread, # but for simplicity... my $client = new Net::SMTP::Server::Client($conn) || croak("Unable to handle client connection: $! "); # Process the client. This command will block until # the connecting client completes the SMTP transaction. $client->process || next; # In this simple server, we're just relaying everything # to a server. If a real server were implemented, you # could save email to a file, or perform various other # actions on it here. my $relay = new Net::SMTP::Server::Relay($client->{FROM}, $client->{TO}, $client->{MSG}); } DESCRIPTION
The Net::SMTP::Server::Client module implements all the session handling required for a Net::SMTP::Server::Client connection. The above example demonstrates how to use Net::SMTP::Server::Client with Net::SMTP::Server to handle SMTP connections. $client = new Net::SMTP::Server::Client($conn) Net::SMTP::Server::Client accepts one argument that must be a handle to a connection that will be used for communication. Once you have a new client session, simply call: $client->process This processes an SMTP transaction. THIS MAY APPEAR TO HANG -- ESPECIALLY IF THERE IS A LARGE AMOUNT OF DATA BEING SENT. Once this method returns, the server will have processed an entire SMTP transaction, and is ready to continue. Once $client->process returns, various fields have been filled in. Those are: $client->{TO} -- This is an array containing the intended recipients for this message. There may be multiple recipients for any given message. $client->{FROM} -- This is the sender of the given message. $client->{MSG} -- The actual message data. :) AUTHOR AND COPYRIGHT Net::SMTP::Server / SMTP::Server is Copyright(C) 1999, MacGyver (aka Habeeb J. Dihu) <macgyver@tos.net>. ALL RIGHTS RESERVED. You may distribute this package under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
Net::SMTP::Server::Server, Net::SMTP::Server::Relay perl v5.10.1 1999-12-28 Server::Client(3pm)
All times are GMT -4. The time now is 03:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy