Questions tagged [udpclient]

UdpClient (System.Net.Sockets.UdpClient) is a .NET-Class allowing to send and receive UDP-Traffic.

575 questions
2
votes
1 answer

An invalid argument was supplied in socket programming

I want to create a UDP client and server in C# and when I run those, after first send and receive message, this error implement. My code is: byte[] barray = new byte[1024]; EndPoint ipre = new IPEndPoint(IPAddress.Any,…
2
votes
1 answer

UdpClient Receives Data on multiple listeners

I have an application which implements an autodiscovery mechanism and I'm having an issue with the UdpClient. It works fine as long as a single instance of the application is open. However, when a second instance is open only the first receives…
Chris
  • 733
  • 1
  • 5
  • 19
2
votes
2 answers

Hololens UDP Server never receives message

I'm making a Hololens app with unity which starts a udp server. This one waits for a message from an external udp client. Here is the server side : using UnityEngine; using System; using System.IO; #if !UNITY_EDITOR using…
Silvering
  • 756
  • 1
  • 6
  • 33
2
votes
1 answer

UDPClient in C#

i use in UDPClient in c#. i invoke the receive function, but the when i am running the app. the program enter to eternity loop. Why is this phenomenon? Maybe because no data were available on this port? what can i do? I write the following code: …
RRR
  • 3,937
  • 13
  • 51
  • 75
2
votes
1 answer

C# Broadcast is UDP message, listen for multiple replies

I am trying to write some code that does a UDP broadcast, and then listens to replies from remote servers saying they exist. It's used to identify machines running a server app on the subnet so basically sends out a "who's there?" and listens for…
David Thielen
  • 28,723
  • 34
  • 119
  • 193
2
votes
2 answers

Is it possible to set UdpClient ReceiveBufferSize property in c#?

I want to change udpclient receivebuffersize in order to prevent buffer overflow when receiving udp packets. is it possible to change it in c#. The actual property is UdpClient.Client.ReceiveBufferSize. Do i have to use other method? Thanks.
Syaiful Nizam Yahya
  • 4,196
  • 11
  • 51
  • 71
2
votes
1 answer

.NET UDPClient: Error: An existing connection was forcibly closed by the remote host

I had a perfectly fine working console program that uses UdpClient.send to send messages to another program on the localhost (over port 7777). (which oddly enough is an almost identical version this C# script, but running in unity3d, and it has no…
Dr.YSG
  • 7,171
  • 22
  • 81
  • 139
2
votes
0 answers

(C#/UWP) Replacing UdpClient code with DatagramSocket

I'm mostly a C++ programmer looking to port some code over to C# but unfortunately developing for the hololens has forced me to use UWP. The following code has been working just fine for receiving some very fast UDP broadcasts (~250-500 per…
2
votes
6 answers

Is there a way cast an object back to it original type without specifing every case?

I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network. I currently do something like for ( i=0;i
Rex Logan
  • 26,248
  • 10
  • 35
  • 48
2
votes
3 answers

Service Fabric Stateless Server Custom UDP Listener

We are trying to define a Service Fabric Stateless Service which listeners for UDP data. We are working with Microsoft who have said that it IS supported and that I should set up for TCP; below is the snippet from the ServiceManifest.xml file…
John Kattenhorn
  • 839
  • 11
  • 25
2
votes
1 answer

Using UDP to control robot via python

I'm working on a robot using a raspberrypi. I was looking for a library that could help me with the networking stuff, like packets &co. So i'm using this code to select the commands I receive: def selectPacket(x): if x == '00': return…
math.random
  • 99
  • 2
  • 10
2
votes
1 answer

Udpclient variable keeps resetting to Null ASP.NET

I am working on a small project that uses an asp website as a UDP listener. The problem is that I use timer and as a result, it loads the page every time causing udpclient to reconnect to the same port again and again, which throws an exception. I…
cicsosoft
  • 65
  • 6
2
votes
1 answer

UdpClient.BeginReceive() does not receive unless it haven't sent shortly before

I'm debugging a strange problem, happening on one of the machines in the live environment. My app (slave) is supposed to be receiving UDP multicast messages at any time from another host (master) in the LAN, but apparently it does so only if the…
ris8_allo_zen0
  • 1,537
  • 1
  • 15
  • 35
2
votes
1 answer

Do I need to synchronise TCP/UDP clients in async BeginReceive Callback

I have a multithreaded network application using a UdpClient, TcpClient, TcpListener, and processing received connections and received data using the e.g. BeginReceive() EndReceive() callback pattern. Using the UdpClient as an example, in this…
khargoosh
  • 1,450
  • 15
  • 40
2
votes
1 answer

Catching an ObjectDisposedException thrown at UDPClient.EndReceive

I'm using an async callback in a windows service to receive UDP data broadcast on a network. The callback uses the UDPClient.EndReceive() method to end the pending async receive. During the service OnStop() method I UDPClient.Close() the UDP…
khargoosh
  • 1,450
  • 15
  • 40