Created
March 25, 2018 09:08
-
-
Save rahulrkroy/0ad6aeff9b10b6f91a9c11ba505315f2 to your computer and use it in GitHub Desktop.
we are doing UDP socket programming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python2 | |
| import socket,time,os,commands | |
| print "we are doing UDP socket programming" | |
| x= socket.socket(socket.AF_INET,socket.SOCK_DGRAM) | |
| # above line means we are using ipv4,on UDP protocol | |
| # belo lines only for receiver | |
| ''' | |
| x.bind(("10.10.5.236",7777)) #7777 is port no,first one is receivers ip | |
| ''' | |
| #for sender | |
| x.sendto("Its Working",("10.10.5.239",7777)) | |
| data= x.recvfrom(100) | |
| print data[0] | |
| sound = "echo "+str(data[0])+" | festival --tts" | |
| os.system(sound) | |
| #for reciver only | |
| '''while 3>2: | |
| data= print x.recvfrom(100) #100 is maximum no of msg receive | |
| print data[0] | |
| print data[1] | |
| time.sleep(2) | |
| sound = "echo "+str(data[0])+" | festival --tts" | |
| os.system(sound) | |
| ''' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment