Operating System - HP-UX
1835055 Members
2307 Online
110073 Solutions
New Discussion

Re: socket program to communicate between WindowsNT and Unix

 
borges
Occasional Contributor

socket program to communicate between WindowsNT and Unix

Hi.

(I apologize for my english)

I have developed a socket program : the client (developed in PERL) is on a unix station and the client (developed in C) is on a windows station.

It doesn't work.
While the server has already been launch, when the client is launched (with the ip address of the server and on the same port as the server) the connect api fails (connection failed).

I don't understand. I haven't this problem when I put the server program on a windows station.

Do you know if their is any particular thing to check, or to do for this client/server application to go on??

PS: the 2 stations can ping each other

Please Help Me. In advance, Thank you very much.

Best regards, Sylvie.


9 REPLIES 9
A. Clay Stephenson
Acclaimed Contributor

Re: socket program to communicate between WindowsNT and Unix

I do this sort of thing quite often and have no problems. One thing that does occurs to me is that HP's delivered perl is quite old; you should probably get a newer version (5.6) from
www.perl.com/CPAN. I would then get the two
machines talking through perl using the simple examples listed in the O'Reilly book 'Advanced Perl Programming'. You should then be able to debug any network/OS problems much faster than in c.
If it ain't broke, I can fix that.
Philip Chan_1
Respected Contributor

Re: socket program to communicate between WindowsNT and Unix

Hi,

I presume your perl program in the Unix side is the server, just do

netstat -a|grep

is the port under LISTENing state?

~Philip
borges
Occasional Contributor

Re: socket program to communicate between WindowsNT and Unix

A. Clay Stephenson, can you please send me a simple example of the O'Reilly 'advanced perl programming' in order to i can test that.

My email : sylvie_borges@yahoo.fr

Thanks.


borges
Occasional Contributor

Re: socket program to communicate between WindowsNT and Unix

Hi.

Thanks to all for your help.

I typed the command 'netstat...', and my is LISTENing on the port.

I typed the command : "netstat -a" on my NT station and how was surprised to see that line:

Proto | Local Address | Foreign Address |State
TCP | ntPC:port1 | unixPC:port2 | ESTABLISHED

Does it mean that the connection was established? What happens?

PS: Both port1 and port2 are not the port that I have indicated.

Thanks for your help.
Sylvie.
Steven Sim Kok Leong
Honored Contributor

Re: socket program to communicate between WindowsNT and Unix

Hi,

Note the user privileges you are using to run the client and server daemons. Note that if you are non-superuser, you are not allowed to use a port number < 1024.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Philip Chan_1
Respected Contributor

Re: socket program to communicate between WindowsNT and Unix

Hi,

I guessed the connection you saw was just some other connection services, because the server port number is static. For example if your server is set to listen to port 2345, then "netstat -a|grep EST" should shown that number as well.

First thing that you should check is whether the server process is really listening, so just run the following command at the server side

netstat -a | grep LISTEN

is your server listening port number on the list?

Rgds,
Philip
borges
Occasional Contributor

Re: socket program to communicate between WindowsNT and Unix

Thanks to all.

I'm not superuser and i'm using a port over 44000.

When i do 'netstat -a|grep port' on my unix station, i saw my server listening on the port i've specified to him.
But, it is when i do 'netstat -a' on my NT pc that i've seen different ports on communication with my NT pc and my unix pc.

It proofs that there i communication; unless, my netstat wouldn't have the ip my unix station. Whereas, the connection failed.

Thanks for your help.
Sylvie.
borges
Occasional Contributor

Re: socket program to communicate between WindowsNT and Unix

Hi!

Instead of having a PERL Unix server communicating with a C NT client; I have now a PERL Unix server communicating with a PERL NT client.

IT WORKS!!!!

My question : what's the problem the C client? Is it a problem of incompatibility??

Thanks for your help.
Sylvie.
A. Clay Stephenson
Acclaimed Contributor

Re: socket program to communicate between WindowsNT and Unix

Sylvie,
Attached is the example TCP socket client/server perl code that you requested.
You can also find many examples at
ftp.oreilly.com/published/oreilly/nutshell
via anonymous ftp.
If it ain't broke, I can fix that.