import socket
import os
import stat
import struct
MAX_PACK_SIZE = 100
DEST_IP = 'localhost'
DEST_PORT = 17800
filename = raw_input("input filename")
filesize = os.stat(filename)[stat.ST_SIZE]
f = open(filename, "rb")
chList = []
for i in range(0, filesize):
(ch,) = struct.unpack("B", f.read(1))
chList.append(ch)
client = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
packSize = 0
string = ""
args = []
for i in range(0, filesize):
packSize = packSize + 1
string = string + struct.pack("B", chList[i])
if (MAX_PACK_SIZE == packSize or i == filesize - 1):
client.sendto(string, (DEST_IP, DEST_PORT))
packSize = 0
string = ""
client.close()