udpclient

ASP.NET UDP socket code works in development, but not in production on IIS

折月煮酒 提交于 2021-01-27 14:46:06
问题 I have the following UDP broadcast listener running as a static component in a seperate thread on an ASP.NET web application. Why I would do this is really, unimportant, but the reason why this wont work when deployed baffles me. I do have several console applications sending UDP broadcasts, and I've coded tested and confirmed this thread and its code working when running under Visual Studio on the VS2005 development web server, but the moment that I compile the code and deploy it to another

ASP.NET UDP socket code works in development, but not in production on IIS

不羁岁月 提交于 2021-01-27 14:00:12
问题 I have the following UDP broadcast listener running as a static component in a seperate thread on an ASP.NET web application. Why I would do this is really, unimportant, but the reason why this wont work when deployed baffles me. I do have several console applications sending UDP broadcasts, and I've coded tested and confirmed this thread and its code working when running under Visual Studio on the VS2005 development web server, but the moment that I compile the code and deploy it to another

Connecting two UDP clients to one port (Send and Receive)

半腔热情 提交于 2020-02-11 04:28:30
问题 I tried the suggestion from this question with very little success. Please... any help will be greatly appreciated! Here is my code: static void Main(string[] args) { IPEndPoint localpt = new IPEndPoint(IPAddress.Any, 6000); UdpClient udpServer = new UdpClient(localpt); udpServer.Client.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); UdpClient udpServer2 = new UdpClient(); udpServer2.Client.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName

Connecting two UDP clients to one port (Send and Receive)

徘徊边缘 提交于 2020-02-11 04:26:50
问题 I tried the suggestion from this question with very little success. Please... any help will be greatly appreciated! Here is my code: static void Main(string[] args) { IPEndPoint localpt = new IPEndPoint(IPAddress.Any, 6000); UdpClient udpServer = new UdpClient(localpt); udpServer.Client.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); UdpClient udpServer2 = new UdpClient(); udpServer2.Client.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName

C# Application not receiving packets on UDPClient.Receive

六月ゝ 毕业季﹏ 提交于 2020-01-20 07:13:07
问题 I've come across a curious issue I can't seem to debug. My application received packets from a device sending UDP packets over a specific port. After setting up the UDP listener, a while loop triggers the Receive command periodically. I should be receiving 400 values at every given time interval and I've even set a process to make sure these values are coming through. Below is a snippet of the relevant code: public UdpClient listener; IPEndPoint groupEP = new IPEndPoint(IPAddress.Any,

How can a udp broadcast packet be received by wireshark but not socket listener

自古美人都是妖i 提交于 2020-01-17 03:57:04
问题 I have a C# app that works on several machines, but for some reason not on another. All are Windows XP. I simply open up a port and listen: void Open() { var myIpAddress = UdpComm.GetPcIpAddress(target); listenEndPoint = new IPEndPoint(myIpAddress, RemotePort); System.Windows.Forms.MessageBox.Show("Creating listener: " + target.ToString() + " - " + listenEndPoint.ToString()); _client = new UdpClient(listenEndPoint); _client.EnableBroadcast = true; _client.BeginReceive(ReceiveCallback, null);

Proper use of IdUDPClient.ReceiveBuffer

我怕爱的太早我们不能终老 提交于 2020-01-14 06:47:08
问题 Thank you for your help. I am converting an older version of Delphi to XE5 and I am getting stuck with the Indy compnent. Need to use IdUDPClient.ReceiveBuffer Here is my code: while not Terminated do begin try lenUDP:= IdUDPClient.ReceiveBuffer(myBuf, buffLength, -1 ); if lenUDP<> 0 then Synchronize(ReceivedLine); except Terminate; end; end; where, myBuf = packed array [0 .. buffLength -1] of char; All help is greatly appreciated. Thank you, Mike 回答1: As I told you in comments to your

UdpClient.ReceiveAsync correct early termination

荒凉一梦 提交于 2020-01-10 02:14:03
问题 Good day. I work with UdpClient and have wrapper upon it. For reading I have asynchronous method: private async Task<byte[]> Receive(UdpClient client, CancellationToken breakToken) { // Выход из async, если произошёл CancellationRequest breakToken.ThrowIfCancellationRequested(); UdpReceiveResult result; try { result = await client.ReceiveAsync().WithCancellation(breakToken); } catch(OperationCanceledException) { // Штатная ситуация ручной остановки Task-а } return result.Buffer; } Where

C# UDP server multiple instances ipv6 same port

我与影子孤独终老i 提交于 2020-01-07 02:55:29
问题 I need multiple UDP servers, using the UDPClient class from .net. For IPv4 i can achieve this by doing the following: var udpServer1 = new UdpClient(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 53)); var udpServer2 = new UdpClient(new IPEndPoint(IPAddress.Parse("127.0.0.2"), 53)); var udpServer3 = new UdpClient(new IPEndPoint(IPAddress.Parse("127.0.0.3"), 53)); And it works, i can listen on all 3 addresses on port 53. I need to do the same for IPv6. But it seems that i can listen on only 1

Structure and tagged union in c

独自空忆成欢 提交于 2020-01-06 15:32:09
问题 #define HOST_NAME "UDP" #define ADDRESS "127.0.0.1" struct UDP_IP_Parameters { uint version; /* e.g. "1.0" = 0x0100 */ uint port; /* PORT */ taggedunion { "HOST_NAME" char[256]; "ADDRESS" char[15]; }; }; int main() { struct UDP_IP_Parameters udp; udp.version = 0x0100; udp.port = 444; } I have created a structure and taggedunion nested within that. Is it possible to define the host name and address as constant like above ?? Is it possible to assign some values by creating a objects for it.