UDP Client can receive data sent from same computer, but cannot receive from separate computer via WLANC# UDP cannot listen on a port that has already been used to send data?Udpclient polling UDP multicast addressAndroid Udp : How to receive datagramPacket from LANUDP client messages not received on a remote serverUDP server in C and client in C#, server receives but client does notCannot Append to Received String in UDP Listener C#Android can send udp but not receiveSending udp message from a remote server to my computer via internetClient does not receive UDP datagram from server if the server responds from a different portWhy are my UDP packets not being received when sent to my own public IP?
What do I need to do, tax-wise, for a sudden windfall?
Someone who is granted access to information but not expected to read it
Is it possible to install Firefox on Ubuntu with no desktop enviroment?
Past vs. present tense when referring to a fictional character
What is the color associated with lukewarm?
Velocity of rotation of a sphere
Nth term of Van Eck Sequence
Background for black and white chart
Is it possible to have battery technology that can't be duplicated?
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
What do you call the action of "describing events as they happen" like sports anchors do?
I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?
How to search for Android apps without ads?
Can an open source licence be revoked if it violates employer's IP?
My parents claim they cannot pay for my college education; what are my options?
Is it ethical to cite a reviewer's papers even if they are rather irrelevant?
Why did the Death Eaters wait to reopen the Chamber of Secrets?
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
Commencez à vous connecter -- I don't understand the phrasing of this
What are the advantages of using TLRs to rangefinders?
Jam with honey & without pectin has a saucy consistency always
Why is C++ template use not recommended in space/radiated environment?
What did the 8086 (and 8088) do upon encountering an illegal instruction?
Should I worry about having my credit pulled multiple times while car shopping?
UDP Client can receive data sent from same computer, but cannot receive from separate computer via WLAN
C# UDP cannot listen on a port that has already been used to send data?Udpclient polling UDP multicast addressAndroid Udp : How to receive datagramPacket from LANUDP client messages not received on a remote serverUDP server in C and client in C#, server receives but client does notCannot Append to Received String in UDP Listener C#Android can send udp but not receiveSending udp message from a remote server to my computer via internetClient does not receive UDP datagram from server if the server responds from a different portWhy are my UDP packets not being received when sent to my own public IP?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have set up a UDP client to receive data in C#. The client is set to receive using the assigned IP address from my WiFi router. The client can receive data if I run the program on the same computer as the sender. But when I try the receive client on a different computer, the client does not receive any data.
I have tried setting the IP address in the UDP client to IPAddress.Any, this did not work. I've tried other ports and this also did not work.
The IP address on the receive side is set to the IP address of the sender. The sender IP address is set to the receiver address. The port numbers are the same.
The important part of the code starts at Private Void Receive().
using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class UDPReceive : MonoBehaviour
// receiving Thread
Thread receiveThread;
// udpclient object
UdpClient client;
//public string IP = "192.168.0.1";
public int port; // define > init
IPAddress ipaddress = IPAddress.Parse("192.168.0.100");
// infos
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = ""; // clean up this from time to time!
// start from shell
private static void Main()
UDPReceive receiveObj = new UDPReceive();
receiveObj.init();
string text = "";
do
text = Console.ReadLine();
while (!text.Equals("exit"));
// start from unity3d
public void Start()
init();
// init
private void init()
print("UDPSend.init()");
// define port
port = 27015;
// status
print("Sending to 192.168.0.100 : " + port);
print("Test-Sending to this Port: nc -u 192.168.0.100 " + port + "");
receiveThread = new Thread(
new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
// receive thread
private void ReceiveData()
client = new UdpClient(port);
while (true)
try
IPEndPoint anyIP = new IPEndPoint(ipaddress, port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print(">> " + text);
// latest UDPpacket
lastReceivedUDPPacket = text;
// ....
allReceivedUDPPackets = allReceivedUDPPackets + text;
catch (Exception err)
print(err.ToString());
private void OnDisable()
if (receiveThread != null)
receiveThread.Abort();
client.Close();
// getLatestUDPPacket
// cleans up the rest
public string getLatestUDPPacket()
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
I set the client IP address to 192.168.0.100 which is the IP address of the sender.
When I run the program on my computer, the client receives. It does not receive on other computers.
I have also tried setting the client IP address to its local IP address, and that also does not work.
It seems that the client can only receive via local host.
Is there something that I'm missing? I've even tried opening the firewall to allow data on port 27015. Also did not work.
c# sockets networking udp client
add a comment |
I have set up a UDP client to receive data in C#. The client is set to receive using the assigned IP address from my WiFi router. The client can receive data if I run the program on the same computer as the sender. But when I try the receive client on a different computer, the client does not receive any data.
I have tried setting the IP address in the UDP client to IPAddress.Any, this did not work. I've tried other ports and this also did not work.
The IP address on the receive side is set to the IP address of the sender. The sender IP address is set to the receiver address. The port numbers are the same.
The important part of the code starts at Private Void Receive().
using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class UDPReceive : MonoBehaviour
// receiving Thread
Thread receiveThread;
// udpclient object
UdpClient client;
//public string IP = "192.168.0.1";
public int port; // define > init
IPAddress ipaddress = IPAddress.Parse("192.168.0.100");
// infos
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = ""; // clean up this from time to time!
// start from shell
private static void Main()
UDPReceive receiveObj = new UDPReceive();
receiveObj.init();
string text = "";
do
text = Console.ReadLine();
while (!text.Equals("exit"));
// start from unity3d
public void Start()
init();
// init
private void init()
print("UDPSend.init()");
// define port
port = 27015;
// status
print("Sending to 192.168.0.100 : " + port);
print("Test-Sending to this Port: nc -u 192.168.0.100 " + port + "");
receiveThread = new Thread(
new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
// receive thread
private void ReceiveData()
client = new UdpClient(port);
while (true)
try
IPEndPoint anyIP = new IPEndPoint(ipaddress, port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print(">> " + text);
// latest UDPpacket
lastReceivedUDPPacket = text;
// ....
allReceivedUDPPackets = allReceivedUDPPackets + text;
catch (Exception err)
print(err.ToString());
private void OnDisable()
if (receiveThread != null)
receiveThread.Abort();
client.Close();
// getLatestUDPPacket
// cleans up the rest
public string getLatestUDPPacket()
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
I set the client IP address to 192.168.0.100 which is the IP address of the sender.
When I run the program on my computer, the client receives. It does not receive on other computers.
I have also tried setting the client IP address to its local IP address, and that also does not work.
It seems that the client can only receive via local host.
Is there something that I'm missing? I've even tried opening the firewall to allow data on port 27015. Also did not work.
c# sockets networking udp client
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12
add a comment |
I have set up a UDP client to receive data in C#. The client is set to receive using the assigned IP address from my WiFi router. The client can receive data if I run the program on the same computer as the sender. But when I try the receive client on a different computer, the client does not receive any data.
I have tried setting the IP address in the UDP client to IPAddress.Any, this did not work. I've tried other ports and this also did not work.
The IP address on the receive side is set to the IP address of the sender. The sender IP address is set to the receiver address. The port numbers are the same.
The important part of the code starts at Private Void Receive().
using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class UDPReceive : MonoBehaviour
// receiving Thread
Thread receiveThread;
// udpclient object
UdpClient client;
//public string IP = "192.168.0.1";
public int port; // define > init
IPAddress ipaddress = IPAddress.Parse("192.168.0.100");
// infos
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = ""; // clean up this from time to time!
// start from shell
private static void Main()
UDPReceive receiveObj = new UDPReceive();
receiveObj.init();
string text = "";
do
text = Console.ReadLine();
while (!text.Equals("exit"));
// start from unity3d
public void Start()
init();
// init
private void init()
print("UDPSend.init()");
// define port
port = 27015;
// status
print("Sending to 192.168.0.100 : " + port);
print("Test-Sending to this Port: nc -u 192.168.0.100 " + port + "");
receiveThread = new Thread(
new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
// receive thread
private void ReceiveData()
client = new UdpClient(port);
while (true)
try
IPEndPoint anyIP = new IPEndPoint(ipaddress, port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print(">> " + text);
// latest UDPpacket
lastReceivedUDPPacket = text;
// ....
allReceivedUDPPackets = allReceivedUDPPackets + text;
catch (Exception err)
print(err.ToString());
private void OnDisable()
if (receiveThread != null)
receiveThread.Abort();
client.Close();
// getLatestUDPPacket
// cleans up the rest
public string getLatestUDPPacket()
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
I set the client IP address to 192.168.0.100 which is the IP address of the sender.
When I run the program on my computer, the client receives. It does not receive on other computers.
I have also tried setting the client IP address to its local IP address, and that also does not work.
It seems that the client can only receive via local host.
Is there something that I'm missing? I've even tried opening the firewall to allow data on port 27015. Also did not work.
c# sockets networking udp client
I have set up a UDP client to receive data in C#. The client is set to receive using the assigned IP address from my WiFi router. The client can receive data if I run the program on the same computer as the sender. But when I try the receive client on a different computer, the client does not receive any data.
I have tried setting the IP address in the UDP client to IPAddress.Any, this did not work. I've tried other ports and this also did not work.
The IP address on the receive side is set to the IP address of the sender. The sender IP address is set to the receiver address. The port numbers are the same.
The important part of the code starts at Private Void Receive().
using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class UDPReceive : MonoBehaviour
// receiving Thread
Thread receiveThread;
// udpclient object
UdpClient client;
//public string IP = "192.168.0.1";
public int port; // define > init
IPAddress ipaddress = IPAddress.Parse("192.168.0.100");
// infos
public string lastReceivedUDPPacket = "";
public string allReceivedUDPPackets = ""; // clean up this from time to time!
// start from shell
private static void Main()
UDPReceive receiveObj = new UDPReceive();
receiveObj.init();
string text = "";
do
text = Console.ReadLine();
while (!text.Equals("exit"));
// start from unity3d
public void Start()
init();
// init
private void init()
print("UDPSend.init()");
// define port
port = 27015;
// status
print("Sending to 192.168.0.100 : " + port);
print("Test-Sending to this Port: nc -u 192.168.0.100 " + port + "");
receiveThread = new Thread(
new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
// receive thread
private void ReceiveData()
client = new UdpClient(port);
while (true)
try
IPEndPoint anyIP = new IPEndPoint(ipaddress, port);
byte[] data = client.Receive(ref anyIP);
string text = Encoding.UTF8.GetString(data);
print(">> " + text);
// latest UDPpacket
lastReceivedUDPPacket = text;
// ....
allReceivedUDPPackets = allReceivedUDPPackets + text;
catch (Exception err)
print(err.ToString());
private void OnDisable()
if (receiveThread != null)
receiveThread.Abort();
client.Close();
// getLatestUDPPacket
// cleans up the rest
public string getLatestUDPPacket()
allReceivedUDPPackets = "";
return lastReceivedUDPPacket;
I set the client IP address to 192.168.0.100 which is the IP address of the sender.
When I run the program on my computer, the client receives. It does not receive on other computers.
I have also tried setting the client IP address to its local IP address, and that also does not work.
It seems that the client can only receive via local host.
Is there something that I'm missing? I've even tried opening the firewall to allow data on port 27015. Also did not work.
c# sockets networking udp client
c# sockets networking udp client
asked Mar 25 at 0:53
HaydenHayden
81
81
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12
add a comment |
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330035%2fudp-client-can-receive-data-sent-from-same-computer-but-cannot-receive-from-sep%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330035%2fudp-client-can-receive-data-sent-from-same-computer-but-cannot-receive-from-sep%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Either you get a wrong firewall rule, or the router does not forward the message. You need some networking knowledge or tools like Wireshark to help.
– Lex Li
Mar 25 at 1:12