#!/usr/bin/python
# -*- coding: utf-8 -*-

##server.py
import commands
from socket import *      #import the socket library

##let's set up some constants
IP = "0.0.0.0" #str(commands.getoutput('hostname -I'))    #we are the host
PORT = 5555    #arbitrary port not currently in use
ADDR = (IP,PORT)    #we need a tuple for the address
BUFSIZE = 4096    #reasonably sized buffer for data

## now we create a new socket object (serv)
## see the python docs for more information on the socket types/flags
serv = socket(AF_INET,SOCK_STREAM)    

##bind our socket to the address
serv.bind((ADDR))    #the double parens are to create a tuple with one element
serv.listen(5)    #5 is the maximum number of queued connections we'll allow

print("listening...")

conn,addr = serv.accept() #accept the connection
print('...connected!')
conn.send('TEST')

conn.close()
