Skip to content

SamJakob/JavaUDPSocketsExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java UDP Sockets Example

This is an example project demonstrating how to communicate between a Java server and client with a UDP socket.

This is a very bare-bones example that does not account for the unreliability of UDP. It is expected that this example would be improved upon to incorporate that.

This is written and tested with Java 16, however if you're using an older Java version the only necessary change should be replacing use of var in the code with the data type (i.e., the class name).

  • ScuffedProtocol.java: is a stub class that simply has a constant for the port number of the protocol.
  • MyClient.java: is a runnable Java file that contains a simple client implementation that allows a user to enter messages to send to a server and prints any received messages from the server.
  • MyServer.java: is a runnable Java file that contains a simple server implementation that converts any received messages to CAPITALS and sends the updated message back to the client.

About

A trivial example of communicating between a client and server in Java with a UDP socket.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages