[VPM] socket problem. please help. it's driving me crazy!

Darren Duncan darren at DarrenDuncan.net
Fri Jan 9 23:01:26 CST 2004


At 7:49 PM -0800 1/9/04, Jeremy Aiyadurai wrote:
>I am wondering if someone can help me with a socket problem.
>I can get windows box to talk to a windows box and linux box to talk to a linux box.
>I am trying to get a linux box and windows box to talk to each other.
>But it just wont work, the scripts just stall. I know they connect, but they wont talk.
>I dont know what I am doing wrong.
>Your help will be appreciated.
>Thanks in advance.
>Jeremy A.
>Here is the code for the client and server

Without running the code, what I can suggest given what you said did and didn't work is that there may be a line termination issue. 

Unix and Windows naturally have different characters for ending lines.  Your server is reading into $data until it reaches a linebreak, which will never come because the client sends something different than the server expects.  That is, unless IO::Socket::INET translates these for you (I doubt it).

I suggest strategic use of code like this on both server and client (its network standard linebreaks I think):

	my $endl = "\015\012";  # cr + lf
	local $\ = $endl.$endl;
	local $/ = $endl.$endl;

I use that myself in my CGI::Portable::AdapterSocket module.

Another suggestion is to look at what IP address the server and client thinks it is.  If the client is trying to talk to a server that is ignoring it, but the server exists, what would happen?

-- Darren Duncan



More information about the Victoria-pm mailing list