[BangPypers] UDP Hole Punching using python

Senthil Kumaran orsenthil at gmail.com
Sat Feb 26 02:07:47 CET 2011


On Fri, Feb 25, 2011 at 08:42:31PM +0530, kunal ghosh wrote:
> step 1: holepunch , send UDP packet from receiver to sender
> from socket import *
> s = socket(AF_INET,SOCK_DGRAM)
> host = "<receiver ip>"
> port = <receiver port>
> s.bind((host,port))
> s.sendto("Message",("<sender ip>",<sender port>))
> 
> here i get the following error
> *error: [Errno 22] Invalid argument*
> i dunno how to resolve this issue.

Don't use the bind call in the UDP client.Make sure your ipaddress is
proper.Otherwise your code looks fine. 

-- 
Senthil


More information about the BangPypers mailing list