Mailing List Archive

Problems with sockets on Win NT
Hi,

I'm trying to exchange datagram (UDP) packets
between a unix machine and a Win NT machine.

The UDP packets sent from Win NT machine are
received properly on unix machine. However UDP
packets sent from unix machine is not at all
received on WinNT machine.

I'm using recvfrom method to receive the packets.

The code I'm using is as below.

# Code on Win NT machine

from socket import *

my_sock = socket(AF_INET, SOCK_DGRAM)
my_sock.bind('localhost', 6123)

while(1):
test = my_sock.recv(1024)
print "got it!"

# Code on Unix machine

from socket import *

my_sock = socket(AF_INET, SOCK_DGRAM)
my_sock.bind('localhost', 6440)

dst_addr = 'leto',6123

while (1):
print my_sock.sendto("Hello", dst_addr)

A help is kindly appreciated.

Thanks
- Murali


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Problems with sockets on Win NT [ In reply to ]
Murali wrote:
>
> I'm trying to exchange datagram (UDP) packets
> between a unix machine and a Win NT machine.
>
> The UDP packets sent from Win NT machine are
> received properly on unix machine. However UDP
> packets sent from unix machine is not at all
> received on WinNT machine.
>
> I'm using recvfrom method to receive the packets.

You sure? That's not what your code says:

> test = my_sock.recv(1024)

- Gordon
Problems with sockets on Win NT [ In reply to ]
mkrishnam@my-deja.com writes:
| I'm trying to exchange datagram (UDP) packets
| between a unix machine and a Win NT machine.
|
| The UDP packets sent from Win NT machine are
| received properly on unix machine. However UDP
| packets sent from unix machine is not at all
| received on WinNT machine.
|
| I'm using recvfrom method to receive the packets.
|
| The code I'm using is as below.

In this code, you seem to be using recv() instead of recvfrom().
Maybe you could follow up with some clarification.

Donn Cave, University Computing Services, University of Washington
donn@u.washington.edu
-----------------------------
| # Code on Win NT machine
|
| from socket import *
|
| my_sock = socket(AF_INET, SOCK_DGRAM)
| my_sock.bind('localhost', 6123)
|
| while(1):
| test = my_sock.recv(1024)
| print "got it!"
|
| # Code on Unix machine
|
| from socket import *
|
| my_sock = socket(AF_INET, SOCK_DGRAM)
| my_sock.bind('localhost', 6440)
|
| dst_addr = 'leto',6123
|
| while (1):
| print my_sock.sendto("Hello", dst_addr)
Problems with sockets on Win NT [ In reply to ]
In article <1278310965-17570891@hypernet.com>,
gmcm@hypernet.com wrote:
> > I'm using recvfrom method to receive the packets.
>
> You sure? That's not what your code says:
>
> > test = my_sock.recv(1024)

Yes, there is a mismatch between code and description. I got it solved.
Thanks for the reply.

- Murali


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.