The same thing you wrote, in VB
and in pythonCode:Sub Main() 'Console.WriteLine("Receiver") Do Dim UDPClient As UdpClient = New UdpClient() UDPClient.Client.SetSocketOption(SocketOptionLevel.Socket, _ SocketOptionName.ReuseAddress, True) UDPClient.Client.Bind(New IPEndPoint(IPAddress.Any, 44126)) Try Dim iepRemoteEndPoint As IPEndPoint = New _ IPEndPoint(IPAddress.Any, 44126) Dim strMessage As String = String.Empty Do Dim bytRecieved As Byte() = _ UDPClient.Receive(iepRemoteEndPoint) strMessage = Encoding.ASCII.GetString(bytRecieved) Console.WriteLine("This is the message you received: " + strMessage) My.Computer.Audio.Play("C:\Users\overwatch\Downloads\mario coin.wav", AudioPlayMode.WaitToComplete) Loop While (strMessage <> "exit") UDPClient.Close() Catch e As Exception Console.WriteLine(e.ToString()) End Try Loop
and I had that part of it working in c# as well but I deleted it out of anger when I deleted my other 20 aborted projectsCode:import os while 1: from socket import * s=socket(AF_INET, SOCK_DGRAM) s.bind(('',44126)) m=s.recvfrom(1024) print m[0] #Uncomment for Mac version os.system("afplay ./ring.wav") #Uncomment for Windows #os.system("start .\ring.wav")
Results 1 to 30 of 97
Hybrid View
-
03-17-2018
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)