Page tree
Skip to end of metadata
Go to start of metadata

To be completed...

testing AppTcpPrint

Also available in testingAppTcpPrint.py.

#!python
import socket

request    = "poipoipoipoi"
myAddress  = '' #means 'all'
myPort     = 21568
hisAddress = '2001:470:1f05:98e::4'
hisPort    = 9

print "Testing AppTcpPrint...\n"

socket_handler = socket.socket(socket.AF_INET6,socket.SOCK_STREAM)
socket_handler.connect((hisAddress,hisPort))
socket_handler.send(request)
print "\nrequest "+myAddress+"%"+str(myPort)+" -> "+hisAddress+"%"+str(hisPort)
print request+" ("+str(len(request))+" bytes)"
socket_handler.close()

raw_input("\nPress return to close this window...")

testing AppTcpEcho

Also available in testingAppTcpEcho.py.

#!python
import socket

request    = "poipoipoipoi"
myAddress  = '' #means 'all'
myPort     = 21568
hisAddress = '2001:470:1f05:98e::4'
hisPort    = 7

print "Testing AppTcpEcho...\n"

socket_handler = socket.socket(socket.AF_INET6,socket.SOCK_STREAM)
socket_handler.connect((hisAddress,hisPort))
socket_handler.send(request)
print "\nrequest "+myAddress+"%"+str(myPort)+" -> "+hisAddress+"%"+str(hisPort)
print request+" ("+str(len(request))+" bytes)"
reply = socket_handler.recv(1024)
print "\nreply "+str(hisAddress[0])+"%"+str(hisAddress[1])+" -> "+myAddress+"%"+str(myPort)
print reply+" ("+str(len(reply))+" bytes)"
socket_handler.close()

raw_input("\nPress return to close this window...")

testing AppTcpInject

Also available in testingAppTcpInject.py.

#!python
import socket

myAddress  = '' #means 'all'
myPort     = 2189

print "Testing AppTcpInject...\n"

socket_handler = socket.socket(socket.AF_INET6,socket.SOCK_STREAM)
socket_handler.bind((myAddress,myPort))
socket_handler.listen(1)
conn,hisAddress = socket_handler.accept()
input = conn.recv(1024)
print "\nreceived "+str(hisAddress[0])+"%"+str(hisAddress[1])+" -> "+myAddress+"%"+str(myPort)
print input+" ("+str(len(input))+" bytes)"
conn.close()

raw_input("\nPress return to close this window...")
  • No labels