sockets help??

2002-02-06 Thread Hotmail - mrengc

Hello,

Just wondering if you could give me a hand with sockets?  If not I understand.


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?

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



Re: sockets help??

2002-02-06 Thread walter valenti



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]




Sockets help

2001-05-30 Thread Jason

I need to write a program that will take a list of url's for pictures
and download them.  I was reading up on sockets but i found them a bit
confusing.  Some assistance with sockets would be very helpfull.

thanks,
Jason




Re: Sockets help

2001-05-30 Thread Walt Mankowski

On Wed, May 30, 2001 at 09:47:51AM -0400, Jason wrote:
 I need to write a program that will take a list of url's for pictures
 and download them.  I was reading up on sockets but i found them a bit
 confusing.  Some assistance with sockets would be very helpfull.

Use LWP::Simple.  It can already do this out of the box, it's very
easy to use, and it doesn't require any knowlege of sockets.

Walt

-- 
Walter C. Mankowski
Senior Software EngineerMyxa Corporation
phone: (610) 234-2626   fax: (610) 234-2640
email: [EMAIL PROTECTED]http://www.myxa.com