>
>
>I am trying to write winsock software to have one client connect to three different 
>server computers (not simultaneously) by simple sock stream.  I tried to create one 
>socket and connect to each computer.  Once the previous connection is completed with 
>one of the computers, I would change the last part of the IP to connect to another 
>computer, but with the same socket.  I used the same port for all connections.  It 
>did not work.  Any suggestions?
>

I don't know the winsock implemantation...but:

When you close the socket, you destroy the socket descriptor => you must 
create a new socket descriptor, for examle:

sub net{
    socket(SO,PF_INET,SOCK_STREAM,getprotobyname('tcp')) || die"$!\n";
    my $ip=$_[0];
    my $port=$_[1];
    my $dest=sockaddr_in($port,inet_aton($ip));
    if(connect(SO,$dest)){
    ###your client code ###
    close(SO);
    return 1;
    }
    else{
    close(SO);
    return 0;
    }
}

    Walter

>
>
>When I use closesocket() function, does that make that socket unusable?
>After you connect to a server computer, then leave continue doing something else, is 
>the connection still live?
>
>Thanx!
>
>Raymond
>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to