Prophet][
Nov 30th, 2008, 05:00 AM
I'm trying to find a simple way take an incoming video stream over UDP and forward it onto another ip address. I don't want to decode the video or view it for anything. I just want a program that accepts the packets and passes them onto another computer on different port. Effectivly a router I guess.
So far I have been using the System.Net.Sockets to try the following code
Declerations:
Public receivingUdpClient As UdpClient
Public RemoteIpEndPoint As New System.Net.IPEndPoint(System.Net.IPAddress.Any, 0)
Dim udpClient As New UdpClient
Dim OutputIP As System.Net.IPAddress = System.Net.IPAddress.Parse("127.0.0.1")
Dim OutputPort As Integer = 1250
Dim InputPort As Integer = 1234
Sub:
udpClient.Connect(OutputIP, OutputPort)
receivingUdpClient = New System.Net.Sockets.UdpClient(InputPort)
udpClient.Send(receivingUdpClient.Receive(RemoteIpEndPoint), 0)
I am aware I'm sending it onto the same computer, I'm only doing it for now for testing purposes. I know this will need to run in a separate thread so that the program doesn't hang waiting for it to finish (which it never will)
I'm being a bit ambishous puting the receive code into the send method. What would be the best way to do this? Use 2 threads, one for receive and one for send? Save it to a buffer?
Any help would be awsome as network stuff is not my thing.
So far I have been using the System.Net.Sockets to try the following code
Declerations:
Public receivingUdpClient As UdpClient
Public RemoteIpEndPoint As New System.Net.IPEndPoint(System.Net.IPAddress.Any, 0)
Dim udpClient As New UdpClient
Dim OutputIP As System.Net.IPAddress = System.Net.IPAddress.Parse("127.0.0.1")
Dim OutputPort As Integer = 1250
Dim InputPort As Integer = 1234
Sub:
udpClient.Connect(OutputIP, OutputPort)
receivingUdpClient = New System.Net.Sockets.UdpClient(InputPort)
udpClient.Send(receivingUdpClient.Receive(RemoteIpEndPoint), 0)
I am aware I'm sending it onto the same computer, I'm only doing it for now for testing purposes. I know this will need to run in a separate thread so that the program doesn't hang waiting for it to finish (which it never will)
I'm being a bit ambishous puting the receive code into the send method. What would be the best way to do this? Use 2 threads, one for receive and one for send? Save it to a buffer?
Any help would be awsome as network stuff is not my thing.