Exemple #1
0
def start_test_server():
    print "starting the test server..."
    sock = create_socket()
    while True:
        data = sock.recvfrom(2**13)
        
        print tools.decode(data[0])
    print "all done"
Exemple #2
0
def mainsock():
    "This is how to receive data packets from a network."
    import socket
    from scosc import tools
    # rolling my own listener. I can double check this when it is time to 
    # use the library to send out data to sc.
    udp_ip = "192.168.2.8" # the ip address of this computer on the network
    udp_port = 57120 # the output port from TouchOSC
    
    sock = socket.socket(socket.AF_INET,    # from internet
                         socket.SOCK_DGRAM) # UDP packet
    
    sock.bind((udp_ip, udp_port))
    
    while True:
        data, addr = sock.recvfrom(2**13) # patrick uses this
        print tools.decode(data)
        print addr
Exemple #3
0
def start_oscemote_server():
    print "starting the OSCemote server..."
    sock = create_socket()
    synth = fOSCTestSynth()
    converter = fOSCConverter(synth)
    while True:
        data = sock.recvfrom(2**13)
        
        converter.oscemote_process_message(tools.decode(data[0]))
    print "all done"
Exemple #4
0
def start_server():
    "Start the server and run the synth."
    print "starting the audio server..."
    synth = fOSCTestSynth()
    sock = create_socket()
    while True:
        data = sock.recvfrom(2**13)
        
        recv_msg(tools.decode(data[0]), synth)
    print "all done"
Exemple #5
0
def start_listener():
    "This is how to receive data packets from a network."
    print "starting listener"
    udp_ip = "192.168.1.1" # the ip address of this computer on the network
    udp_port = 57199
    
    sock = socket.socket(socket.AF_INET,    # from internet
                         socket.SOCK_DGRAM) # UDP packet
    
    sock.bind((udp_ip, udp_port))
    
    while True:
        data = sock.recvfrom(2**13)
        
        recv_msg(tools.decode(data[0]))