I made an online game that uses the UDP protocol to communicate between the clients and a server. However, since UDP is connection-less, I can't detect if a client closed the game or an error occurred in the network. Therefore, I need to make UDP a connection-oriented protocol, or at least detect network errors. How could I accomplish that? How is TCP connection oriented?
Making UDP a connection-oriented protocol?
947 Views Asked by None At
2
There are 2 best solutions below
1
Phil Taprogge
On
As you say, UDP has no concept of connections. So the only way to achieve what you want is to implement the required logic yourself on top of UDP.
You could, for example, have your clients 'check in' with the server regularly with a UDP packet containing a unique ID. If the server does not receive this from a client for some time, it would consider that client dead.
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in NETWORK-PROGRAMMING
- "(Reason: CORS header ‘Access-Control-Allow-Origin’ missing)" while trying to access Actix webserver from Wix site
- My server TCP doesn't receive messages from the client in C
- I am currently trying to implement a rudimentary firewall from a video I watched but the nimda worm detection is not working and i do not know why?
- Is there a way to trigger a network buffer flush in Python?
- Redirect outbound traffic to a different port
- Post request response time spikes
- How to connect docker container to vpn site to site
- EADDRNOTAVAIL Node JS
- How to handle Okhttp3 POST Failing after changing location? Roaming issue?
- Why my message doesn't write into the socket when I try to read the response after sending it?
- Networkx Multiple Circular Layouts Combined Together
- trivial socket program failing at accept() with errno 22
- getaddrinfo() returning unexpected results
- JmDNS create() function not working on my device
- What C code will determine the network adapter being used by an open socket?
Related Questions in UDP
- Discussion on using golang to implement UDP client timeout retransmission
- What is the correct way to setup and use the Ethernet library in Arduino in order to send and receive UDP broadcast messages between LAN devices?
- Multicast packets not received on windows
- Microcontroller hangs with LWIP UDP
- UDP socket client not able to receive data
- "Parameter is not valid" exception when using Image.FromStream() - UDP Video live stream
- k3s change requested UDP port assignment
- Why does the python client socket receiving a reply but still throw the exception in some threadings?
- Gnuradio "double free or corruption (!prev)" error
- Why we need wraparound in UPD checksum algorithm?
- Simple Java UDP server/client-program works on local machine but not over either LAN (different machines) or internet
- Docker bridge does not transmit from tcpreplay IPv6/UDP/GTP traffic
- trying to send TCP packet and recieve it back and count time in client+server app
- recvmsg returns EAGAIN after select reports file descriptor is ready
- Receiving UDP broadcast on Android
Related Questions in CONNECTION
- MongoDb not connecting C#
- Frontend fetching data from unexpected localhost address despite proxy configuration
- recognize_google fails with WinError 10060
- April fools - PsExec (PsTools)
- Unable to resolve service name to its IP inside kubernetes cluster
- Is there a way to create connection pooling in codeigniter 3 using custom mysqli driver?
- Error in releasing pool connection in node project
- Is there a way in Laravel to use multiple connections simultaneously in a combined manner?
- Not able to inject RedisCache/SyncCache/StatefulRedisConnection beans in micronaut 4.2.1 version
- How to send a big array to a client faster
- Connection Type not visible in Airflow connections
- Cannot connect to an Oracle XE database from C#
- SSMS Update Causes Connection Failure and Exception Error
- Mutual connections in Strapi
- Microsoft SQL Server Express Java Connection
Related Questions in RUDP
- How to create a simple Server Client Application Using RUDP in Java?
- Checksum checking in UDP using UDP socket
- RUDP Packets are not read from inputstream
- TCP, UDP, SCTP, RUDP or RAW?
- RUDP implementation other than bell labs implementation?
- Reliable UDP Protocol Implementation in Java - Why does this happen?
- Is there Reliable UDP implementation for C++ with python asyncio bindings?
- websockets protocols?
- Broadcasting in RUDP, UDT, LWIP, DCCP
- TCP vs Reliable UDP
- Error Occurs with QUIC_TLS_CERTIFICATE_UNKNOWN When Attempting WebTransport Connection
- Is there a way to callback a function without creating a new goroutine?
- how to use maidsafe-rudp as part of my project?
- change FTP server's transport protocol (pyftpdlib)
- Making UDP a connection-oriented protocol?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Firstly, I understand that you need UDP because of efficiency - but maybe you could try to give TCP a try?
Otherwise I would just do as @Phil Taprogge mentioned. Send a specific UDP package that gets identified by the server every n seconds. If the server does not recieve it for 3*n seconds it is very likely that the client has disconnected.