Click here to Skip to main content
15,890,947 members
Everything / UDP

UDP

UDP

Great Reads

by Orekaria
Lightweight .Net library for UDP LAN broadcasting.
by honey the codewitch
Explore an Arduino based IoT web server and UDP multicaster for monitoring a remote water pump
by Zehaie M. Hailu
Python lends itself to the development of multi-threaded GUI and network applications.
by Huang Geng Geng
If you are looking for a tool

Latest Articles

by Mirzakhmet Syzdykov
Network programming in C++
by hemanthk119
This article describes modification of Arduino NINA firmware to wirelessly transmit I2S microphone data.
by Mark Beharrell
A queue based UDP protocol
by honey the codewitch
Explore an Arduino based IoT web server and UDP multicaster for monitoring a remote water pump

All Articles

Sort by Updated

UDP 

16 Mar 2024 by Line Item
I would try running this from a command line, with some adjustments for that to make it a simple command. Get that to work then add to that a little at a time. Maybe then try moving that to PowerShell. Get that to work then add more until you...
26 Jun 2023 by Member 15070471
Visual Studio 2019, VB.Net. Just getting back into coding after many years and thought I would start by setting up a simple chat app in VB.Net. I've downloaded many examples of UDP and TCP/IP, including here, from Code Project, and all have the...
26 Jun 2023 by OriginalGriff
RecieveBufferSize is not the same as the number of bytes in the buffer itself: it's likely to be considerably bigger. So when you try to read RecieveBufferSize into your array: Dim inStream(10024) As Byte buffSize =...
24 May 2023 by Mirzakhmet Syzdykov
Network programming in C++
24 Apr 2023 by Fatin Fatima Abdullah
I am working on a program for TCP/UDP port scanning. TCP is working fine and well but it seems like I have no idea on how to achieve the UDP port scanning using the AutoIt.Since the UDP port is connectionless I am using UDPOpen function to bind my $PortIP and $PortStartNumberB....
24 Apr 2023 by Member 15987316
May be it help Local $port If $CmdLine[0] == 0 Then MsgBox(0x0,"Err","arg is empty") Exit 1 Else $port = $CmdLine[1] EndIf Func _MyPortExists($port) Local $sRead, $sBuffer, $CMD_PId $CMD_PId = Run(@ComSpec & ' /c netstat -an |...
30 Mar 2023 by Stan Huang
Net-Snmp v5.9.3 was ported at my NAS, which was Linux-based. The SNMP module works fine except it doesn't response to IPv6 client of global unicast. That's that it can reply to SNMP clients thru IPv4 or IPv6 with link local address, but not IPv6...
2 Nov 2022 by CarlyJeps
Hello how can i fixes this error [Error] SFML/Network.hpp: No such file or directory The code: #include #include #include #include #include static bool port_is_open(const...
2 Nov 2022 by Rick York
Richard is correct. It is important to understand the difference between using angle brackets () and quotes with include directives. The quotes will look for files in the local directory first, which is where the source file is, and then in...
2 Nov 2022 by k5054
If the SFML code is in the current directory, then use #include "SFML/Network.hpp" When you use #include the compile only searches the System directories (e.g. /usr/include, /usr/local/include, some others specific to the compiler) and...
2 Nov 2022 by Richard MacCutchan
The message is clear, the compiler cannot find that file or directory. Assuming this is some third-party header, you need to provide the full path, or add its location to the compiler search path.
17 Oct 2022 by hemanthk119
This article describes modification of Arduino NINA firmware to wirelessly transmit I2S microphone data.
26 Sep 2022 by Death Smoke
I'm trying to make a connection between two computers both of them are using tp-link adapter , but i'm not receving anything from client . #include #include using namespace std; int main() { ...
10 May 2022 by Âu Quang Vũ
How can i connect client to server by using udp socket with java swing What I have tried: i dont know, ill tried but its only gonna get worse
10 May 2022 by Richard MacCutchan
Study the tutorials: Lesson: All About Sockets (The Java™ Tutorials > Custom Networking)[^]
29 Mar 2022 by jake_jane
It sends actually all bytes and files successfully. The problem is when it is received on the server-side. It receives the whole data byte but It is not receiving the whole packet data. Help me, please Here is my code. What I have tried: Sender...
29 Mar 2022 by Greg Utas
If you're writing code at this level, you need to debug it yourself. It's very unlikely that anyone here will do it for you. Even if they wanted to, they'd first have to create the parts of your code that are missing, like socket allocation. If...
19 Jan 2022 by Prachith Goonasekara
I have a windows application that is working as a udp listener, I am trying to make it as a web application(MVC). the udp listener is running in a continues loop listening to the port all the time. is there any tutorials that I can use to convert...
19 Jan 2022 by Dave Kreskowiak
You're going to have to go into more detail as to how you expect this app to work. ASP.NET/MVC code (C#, VB.NET) runs entirely on the server, not the client. So, if your code is listening on a UDP port, it's the server that's doing the...
13 Dec 2021 by gary hagerty
Hello Guys, Please bare with me with this as I am somewhat new to using the Winsock control with VB6. The situation is this, The requirement is that I use UDP and not TCP I have an application running on a computer which we will call...
13 Dec 2021 by CHill60
Quote: but I am kind off stuck with having to do this in VB6, since the DLL's that I used to interface to our embedded controls were done in VB6 as well. No - you're not :-) See Solution 2 to this question How to use vb6 DLL function in C# .NET...
10 Dec 2021 by gary hagerty
Hello, I want to write a simple chat program using the Winsock control with VB6 and UDP in one application, is it possible to do this? Thank you Gary What I have tried: I have searched the internet for some example but did not find anything...
10 Dec 2021 by OriginalGriff
You probably won't find exactly what you want to hand in, but a simple google gives you all the components, used in different projects: chat program using the Winsock control with VB6 and UDP - Google Search[^] So start with those, and get the...
13 Nov 2021 by Mark Beharrell
A queue based UDP protocol
19 Jun 2021 by Member 15245946
Hello, I am trying to make chat for two users(using select()), but i am stuck on this code: #include #include #include #include #include #include #include ...
19 Jun 2021 by Richard MacCutchan
As I told you yesterday you are referring to remoteportand localport, but you never initialise them to anything. Look at your main code: int main(int argc, char *argv[]){ int localport; int remoteport; int sock_fd; struct sockaddr_in...
18 Jun 2021 by Member 15245946
Hi, i have udp chat in C, but on terminal is written: Bind error : Permission denied, I tried a lot of different ports but nothing is working. What can be a problem? What I have tried: sock_fd = socket(AF_INET, SOCK_DGRAM, 0); ...
14 Jun 2021 by Member 15245946
Hi, I have client and server program. How can I make talker which combined server and client in one code, and how can client or server write more than one message(I think to use select()but I don't know how). Thanks What I have tried: I have...
14 Jun 2021 by Greg Utas
Combining a server and client probably isn't appropriate. They should run on different threads, which should also be separated from their work and GUI threads, respectively. All of them can be in the same .exe, though. Although it may be more...
24 May 2021 by José Silva 2021
hello, i'm making a messaging app using udp to handle clients and tcp to handle admin struct sockaddr_in si_minhaTCP,si_minhaUDP, si_outra; int nready, maxfdp1; int fdTcp; int fdUdp; fd_set rset; if (argc != 4) { printf("server {client...
24 May 2021 by KarstenK
My tip is that the receive is waiting to get the FULL buffer read - but it doenst get so much data. Read only 1 byte and use a loop. The typical issue in such code is that one side is in some bad state, so it doesnt work like socket closed,...
21 Apr 2021 by Arda Güler
Hi, I recenlty started working on a streaming app (c#). I made the general design but I'm still unceartin of the protocol I will use. I read that UDP is the most preffered choice for video streaming (because of speed I guess). and I've watched...
21 Apr 2021 by Greg Utas
Video streaming usually uses the Real-Time Streaming Protocol[^]. As Richard pointed out, UDP will force you to handle packets that get lost or arrive out of order. And TCP is too inefficient for streaming. RTSP was invented to address these...
20 Apr 2021 by Richard MacCutchan
The main issue is that UDP messages are not guaranteed to be delivered, or delivered in the correct order. Whereas TCP message are guaranteed to be delivered and in the correct order. So if you use UDP you need to add your own message control to...
20 Apr 2021 by Member 15034232
// include 와 같이 System 라이브러리 사용 선언. using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using Packet; namespace WindowsFormsApp16...
19 Apr 2021 by OriginalGriff
You cannot use a blocking call in a UI event handler (or any other code on the UI thread) without "freezing" the user interface: if the UI thread is busy waiting for your Receive call to return, then it can't update the display in any way. And...
19 Apr 2021 by Ralf Meier
I suppose that your method Button1_Click ctches the same-named Event from the Button. With your While-Loop (While TRUE) you hold your Applicaion all the time in this method. Your Application is no longer responsible ... What do you think is the...
20 Jan 2021 by Richard MacCutchan
UpdateLabel() You forgot to pass the temp value to the UpdateLabel function. It should be: update_label_1(temp) [edit] Corrected the function name. [/edit] [edit version="2"] I have reviewed your code and the issue is slightly more...
19 Jan 2021 by Member 14589606
Im trying to display the real time temperature of the sensor on the GUI, Im able to get different temperatures and updated temperaure in the console but when I link it to a label in the GUI, it does not update, it only updates for the first time...
23 Nov 2020 by Jags27may
I want to develop an application in c#, which can ran on a Client system to access their desktop from my HOST machine (i.e. remote desktop tools like anydesk, teamviewer etc. What I have tried: I already check RealVNC & tightVNC but want to...
5 Nov 2020 by honey the codewitch
Explore an Arduino based IoT web server and UDP multicaster for monitoring a remote water pump
22 Jun 2020 by Richard MacCutchan
UDP messages are not guaranteed to be received in the correct order, or even received at all. Switch to TCP if you require guaranteed delivery.
22 Jun 2020 by girishmeena
Hello All, I am facing same issue which is mentioned in these questions and I can delete it if the same answer applies to this, however I am not able to find solution for myself through these answers....
22 May 2020 by Mehdi Gholam
This is how TorpedoSync came about, from the use of other software to sync "My Documents" across my machines and finding them troubling.
1 Oct 2019 by Member 14589606
Hey Im creating the UDP Client on the top and then creating it again in initialise job, when I remove the try and catch, the socket has a value of null, I communicate thru the socket and then close it after that I REPEAT but either the port it not closed properly as it displays an error stating...
24 Sep 2019 by Member 14589606
When I run the program it says: "System.Net.Sockets.SocketException: "Normally, each socket address (protocol, network address, or port) may only be used once" It shows an error here: socketCmdText = new UdpClient(cmdTextPort); -The socketCmdText is also has a value of null This is my code:...
18 Sep 2019 by Member 14589606
Only one reading can be taken from a sensor at a time. I used the concept of asynchronous sockets, that is, it is only reading the processor temperature of a single sensor at a time. When you add more, it shows that there is an error. Any ideas would be appreciated. After executing the jobs,...
18 Sep 2019 by Patrice T
Quote: Can only read one temperature reading from the processor of the sensor, for other sensors it does not work The usage of try/catch in your code prevent the program from telling you where the problem arise, and this is an important information. A try/catch is used to hide an error that you...
18 Sep 2019 by OriginalGriff
Quote: The object reference was not set to an object instance This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable,...
29 Jul 2019 by Member 14499788
Hallo Everyone, I have a program which can receive udp packets continuously from the server, but how can i check new packet is received ufrom the server? My program for receiving udp packet i have written below. if anyone has idea about it , please do share! Thanks in addvance cheers! ...
29 Jul 2019 by Rick York
You can check by looking at how many bytes the Receive function returns. If it's greater than zero then you have received a message. At that point, this method could call method to process the message or set a flag so something else knows that it needs to. There is no need or sense in adding...
1 Jul 2019 by Gerry Schmitz
The usual protocol is that the "master" sends first, and the slaves respond. A slave never sends without being asked; it waits for a send request. When the master starts, it polls available addresses (typically a subset within 1-31; 1-255; etc), with "address 0" for a general broadcast to all...
1 Jul 2019 by dj4400
Hi, I am building a little UDP server client app. in c++ In all the examples on the net that i saw, the server is 1st of all receives from the client and then sends and the client 1st of all sends to the server and then receives from it. I want the server to 1st of all send and the client to...
18 Apr 2019 by danger moose
Im trying to run a WCF service self hosted on visual studio that is able to send and recieve udp messages. The send works fine but I cant verify it using the recieve. What I have tried: Ive tried to recieve both from the same service and from an outside source on a different port but on the...
18 Apr 2019 by Gerry Schmitz
WCF Test Client (WcfTestClient.exe) | Microsoft Docs[^]
11 Feb 2019 by SheepRustler
I'm trying to broadcast a message to devices that reside on a wired network using a UDP broadcast as my devices will return a string identifier when they receive "SEEKING REPLY" string on port 30303 Everything works great until I turn my PC Wifi on - then nothing is found. I've a suspicion...
20 Nov 2018 by Engr.Shah
Hi there, still not mature in c# programming, i have written an application in which it receives data from arduino using UDP protocol, when i click a button data is sent and received without hurdle, but i want my application to receive data automatically when arduino sends it. so that i wont...
20 Nov 2018 by Afzaal Ahmad Zeeshan
You need to attach the async callback1, that receives the data for your socket, on its behalf and then alerts you that data has been received. You cannot attach a receive function, as it might be blocking. You can argue, that, // Your receive call is useless as well, and so would be this, ...
7 Oct 2018 by Member 10200096
I have to make a server-client file transfer using UDP . I have created a basic server which receives message sent by client . That's all. Now comes the major part :-1. The message sent by client is the name of file .2. Now the server checks whether there exists this file or not .3. If...
7 Oct 2018 by Member 14010597
can anyone tell me how to compile this code ,where we are specifying the file directory???????????
22 Aug 2018 by Dave Kreskowiak
Simple, YOU DON'T! UDP does not guarantee delivery of packets, let alone the receiver(s) getting the packets in the correct order. UDP is typically used as a "broadcast" protocol, sending data to one or more clients where the data doesn't have to be complete for the receivers to understand it,...
22 Aug 2018 by Member 13957140
I am sending bytes array into udp port but I dont know how to ack. What I have tried: I have tried to send packets to UDP server. I am receiving the same packets in the receiver. Is that mean packets are successfully sent?
21 Aug 2018 by Jochen Arndt
UDP is a Stateless protocol - Wikipedia[^] where you don't have any feedback. If you need some kind of acknowledgement, it has to be implemented in the top protocol. That means you have to define such a protocol or use an existing one and implement it in code. But it is usually better to use...
8 Aug 2018 by Member 13769611
I want status update from the devices which communicate on udp, every minute. what method i should use. Any kind of suggestions will be appreciated. Thanks What I have tried: I have tried this foreach (IPAddress ips in iPAddresses) { Byte[] receiveBytes = { }; ...
8 Aug 2018 by Gerry Schmitz
You're not checking the "connect" (return) status. You're probably failing to connect; or not "waiting" long enough. But since you're effectively ignoring any errors ("empty" ex handler), you're left to wonder what's going on.
4 Apr 2018 by KarstenK
For sending over the network the splitting of the binary data is enough. If you want smaller jpeg than you must use higher compression or split the decompressed picture in sub pictures and than compress. The article CXImage shows these techniques.
4 Apr 2018 by Balaraj Nayak
How to fragments large data into small packets. since i am beginner i am unable achieve it, SOMEBODY HELP TO FRAGMENT LARGE DATA INTO SMALL PACKETS . say i have 22kb of jpeg file i want it to devide into small packets with 960 bytes of each. for jpeg there will be STARTING two bits and ENDING...
4 Apr 2018 by Jochen Arndt
Your code will not work because the image data might contain the JPEG markers too (here: the FF D9 end of image marker). So you have to write a parser that gets also the segment length for all non stand alone markers. When such a segment is processed, pass all bytes of the length without...
8 Jan 2018 by saide_a
I have a UDP connection that connects an echo server with a test client. test client continuously sends packets and waits about a second for receiving them. if it can't get the packet, assumes that packet is lost and sends another packet. Most of the packets are sent and received successfully...
8 Jan 2018 by KarstenK
As all wrote the use of TCP is in that case better. Another solution is to use UDP packets with a time stamp or counter in the payload, so you check which packets are to drop.
8 Jan 2018 by Jochen Arndt
When using localhost (loopback), there should be no packets lost and no significant delay. So the problem may be sourced by your implementation (probably the server code that handles receiving). Network receiving code should be event driven running in an own thread. Then it can react...
13 Sep 2017 by Dave Kreskowiak
Sure. UDP is "connectionless". It doesn't care if anyone is listening. It just sends the data to whatever destination you tell it to, including broadcast addresses. There are no "bounce back" messages that tell the sender the destination doesn't exist or isn't listening on the port you're...
13 Sep 2017 by Member 13408538
Is it possible to have a device with an Ethernet interface that only transmits UDP data? No incoming, no handshaking. I just want to know if it is possible, not if it is advisable. I need a device that will not listen to any incoming signal, but continuously sends it's data out to the network...
13 Sep 2017 by Rick York
Yes, it is possible to do that. I implemented something similar that listens for incoming messages but only rarely receives any. Occasionally it doesn't receive anything for weeks at a time so it is close to what you are after.
6 Jul 2017 by Pascal-78
Hi,Here is my problem:I try to send a lot of data (big images) between 2 PC using UDP socket (UDP is the only choice for Multicast).I use something like RUDP (Reliable-UDP), basically:- the Server sends a lot of UDP packet with id (one per image) and packet index- the Client...
6 Jul 2017 by Javier Luis Lopez
I have a similar problem, but I can withdraw images with packets lost. I solved the problem making following steps: 1. Increasing the socket buffer size as said Pascal-78 2. In the receiver part I made a separate thread that only receives packets 3. Maintain the link live by sending back an...
17 Apr 2017 by Anup KumarArya
all coding is correct. only i did change ip add and the important thing whenever you run a udp program just close firewall or any type of antivirus that is available in your system. Now it is working
10 Apr 2017 by Anup KumarArya
First program which runs on my computer import java.io.*; import java.net.*; public class NewUDP22 /*main class*/ { public static void main(String arg[])throws Exception { /*calling both threads ReceiveDataClass and SendDataClass*/ ReceiveDataClass t=new...
10 Apr 2017 by Jochen Arndt
Your system sends to this address: InetSocketAddress sd=new InetSocketAddress("192.168.8.101",40000); The other system sends to: InetSocketAddress sd=new InetSocketAddress("192.168.8.101",50000); Did you see it now? The other systems sends the data to himself on port 50000. You have to specify...
22 Mar 2017 by bkelly13
I am trying to create a simple UDP app to capture data being sent by another app. When the code hits the call to recvfrom() method it returns -1 and WSAGetLastError returns 10022. I am unable to detect what is wrong with the arguments. Here are the declarations, the setup, and the call. ...
22 Mar 2017 by Jochen Arndt
You have not bound the socket. See the recvfrom function (Windows)[^]:Quote:WSAEINVALThe socket has not been bound with bind, or an unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled, or (for byte stream-style sockets only) len was zero or...
22 Mar 2017 by bkelly13
To RM,Thanks for the reply.The declaration of m_receive_socket in my code isSOCKET m_receive_socket;When SOCKET is chased down the definition istypedef UINT_PTR SOCKETI do not know how the SOCKET item could contain the IP address.
8 Mar 2017 by Member 13046160
HelloI want to send a data to the printer via udp port. I have a structure of that udp packet but have no idea how to build it.The structureDoes anyone have an idea?What I have tried:UdpClient udpClient = new UdpClient(); udpClient.Connect("192.168.0.99",...
8 Mar 2017 by Jochen Arndt
Create a C# structure that corresponds to the structure definition. This structure must not contain padding bytes (Pack = 1) and use members with fixed width (use byte, UInt16, UInt32 according to the length of the fields). See StructLayoutAttribute.Pack Field...
25 Feb 2017 by DiamondKid
I am developing a two-player Quiz bee game LAN-Based. The players takes turn one at a time. A player will click a button to pick a question. On the first two turns, sending and receiving of data are working but on the third turn the other player didn't receive the incoming data.Anyone can...
25 Feb 2017 by Graeme_Grant
Apps that appear "locked up" is usually an indication that a long running task is active on the UI thread blocking the UI message pipe. If you are indeed using Sam's code, then the UDP tasks are on a sperate thread. To Debug this, when there is a long pause/"app appears locked" event, hit...
7 Nov 2016 by inlandchris
I have been programming in C++ since 1989. However, they were in-house programs for GTE. Now, I have a very large project (retired now) that I want to change from Serial to TCP/UDP polling. Far end are RS422 devices that communicate on 4 wires and can be converted to USB virtual ports. Now that...
7 Nov 2016 by Albert Holguin
Well, if you're not sure, TCP/IP should usually be your default go-to. That's because it has a lot of neat built-in overhead that's very useful, such as retransmissions and error checking, that UDP doesn't have. UDP should be used when you need high-speed transmissions where you don't mind...
26 Jul 2016 by Zehaie M. Hailu
Python lends itself to the development of multi-threaded GUI and network applications.
20 Jun 2016 by Intel
Before you embark on a new Internet of Things project, you should consider which communication patterns are best suited to it.
21 May 2016 by Sladetbask
Hello, I have had this problem with a udp packet sender that i have.I want the port to be inputed with arguments but as my code is set up the port is set with:#define SERVICE_PORT 123 /*123 is the port for this example*/before:int main(int argc, char *argv[])Is there eny way for...
21 May 2016 by Sergey Alexandrovich Kryukov
The arguments of entry-point function main come not from your code, but from the user.Say, if the user entersyourApplication 8080oryourApplication -port:8080it means that the main function is called with argc == 1; and argv[] will be the string containing port number of the option...
20 May 2016 by Sladetbask
Hello, I want to send a packet or a string over the internet in C,and most of my questions that i have asked on diffrent forum just don't really help,so i have used something from a webpage that maybe can help ppl help me.You can download the file:Here[^]And the place i found it...
20 May 2016 by Richard MacCutchan
You already posted this question at How do I use UDP sockets in C [LINUX][^] and received feedback. Please do not repost.
19 May 2016 by Sladetbask
I want to send a UDP packet to a ip or domain and i don't want to receive eny packets. Just that simple, Just answer how to:1: Make the socket.2: Make it so that the packet will be sent to ip.3: Send the packet.That's all. :)What I have tried:i have just tried googleing it...
19 May 2016 by CPallini
I compiled the same sample code (I suppose[^]), on my Lubuntu 15.10 Box.Got the following output: (build process)gcc -g -c -o udp-send.o udp-send.cudp-send.c: In function ‘main’:udp-send.c:54:6: warning: implicit declaration of function ‘inet_aton’...
28 Feb 2016 by Member 12353779
I have a code for single client - server but i am confused how to convert it to multiple client-server in a LAN network.I have a project to connect pcs in a LAN network like colleges or cyber cafes and exchange data between the clients and the server.I want the code for UDP connection and in...
25 Feb 2016 by Jochen Arndt
Because UDP is connectionless, you have to send some data and wait some time if you get an ICMP Destination unreachable (Wikipedia)[^] message with code 3 indicating that the port is unreachable. But note that a time out is not a reliable indication that an UDP service is listening. If...
20 Feb 2016 by Andy_N
Is is a small app with UDP & dataGridView.While first start Firewall ask confirmation for UDP and Form of app is white (w/o dataGridView). After that happens nothing. I have to close & start again and then works all properly.Thanks for help.AndyWhat I have tried:UDP Listener...