#!/usr/bin/env pythonimport struct, sysdef htons(num): return struct.pack('!H', num)def htonl(num): return struct.pack('!I', num)def ntohs(data): return struct.unpack('!H', data)[0]def ntohl(data): return struct.unpack('!I', data)[0]def sendstring(data): return htonl(len(data)) + dataprint "Enter a string:"str = sys.stdin.readline().rstrip()print repr(sendstring(str))
Name (required)
email (will not be published) (required)
Website