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??

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

2001-05-30 Thread Randal L. Schwartz

> "Jason" == Jason  <[EMAIL PROTECTED]> writes:

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

CPAN has Image::Grab, perhaps exactly what you want.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



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




Re: Sockets help

2001-05-30 Thread Ondrej Par

Hi,

better than playing with sockets and doing all that low-level HTTP stuff, 
take a look at LWP module(s). That's exactly what you need.

On Wednesday 30 May 2001 15:47, 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.
>
> thanks,
> Jason

-- 
Ondrej Par
Internet Securities
Software Engineer
e-mail: [EMAIL PROTECTED]
Phone: +420 2 222 543 45 ext. 112




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