from socket import *
import sys
import time
from math import *
local_port = 5003
remote_port = 4422
remote_port = 4321
outgoing_if = "127.0.0.1"
remote_host = "127.0.0.1"
UDPSock = socket(AF_INET, SOCK_DGRAM)
UDPSock.bind((outgoing_if, local_port))
hash = "s2l\n<8<18 "
alpha = chr(55)
z_buffer = chr(1) + "\n"
width = 12
height = 8
segments = 8
segwidth = 12
segchannels = 3
sleeptime = 0.1
t = 0
frequency = 2*pi/20
while (1):
data = hash
data += z_buffer
for j in range(0,height):
for i in range(0,width):
pixel = 0.5 + 0.5*sin(2*pi*(float(i+1)/width)+t*frequency)*sin(2*pi*(float(j+1)/height)+t*frequency)
char = chr(int(127 * pixel))
data += char + char + char + alpha
data += "\n"
for i in range(0,segwidth):
for j in range(0,segments):
for a in range(0,segchannels):
val = 63 + int(63*sin(2*pi*(1+i)*(1+j)*t*frequency/200))
data += chr(val)
data += alpha
data += "\n"
t+=1
if not data:
break
else:
UDPSock.sendto(data,(remote_host,remote_port))
time.sleep(sleeptime)
UDPSock.close()