question: python and UDP
ricky
mzou at bu.edu
Sun Mar 24 22:29:05 EST 2002
I am trying to write a python program to connect to a proxy server which
takes the following header:
however, the proxy server doesn't seem to understand the header i sent to
it.
all the ips were converted into binary format:
serverip = socket.inet_aton(socket.gethostbyname(<hostname>))
and port number were converted to host byte order:
serverport = socket.htons(int(sys.argv[x]))
My question is how do i format the header so that proxy server would
understand the information I send to it.
the proxy server accepts UDP connection...
i'd approxiate it if u could reply to my email address as well
thank you
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32 bit IP address for your client |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | Server| |
| 16 bit port # for your client | Flags | Unused |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32 bit IP address for server 1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32 bit IP address for server 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32 bit IP address for server 3 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32 bit IP address for server 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 16 bit port # for server 1 | 16 bit port # for server 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 16 bit port # for server 3 | 16 bit port # for server 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Defined by you |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Defined by you |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Defined by you |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The four bit Server Flags field specifies to which servers the packet should
be sent. Each bit of of the field represents one of the four servers. A 1
bit indicates that the packet should be sent to that server and a 0
indicates that the packet should not be sent to that server. For example, if
the field were set to 1110, the proxy server would send the packet to
servers 1-3 but not to server 4.
More information about the Python-list
mailing list