Skip to content

Laastine/Fsharp-udp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FSharp UDP Example

Environment

Build

pushd src/Server/ && dotnet build &&\
popd &&\
pushd src/Client/ && dotnet build &&\
popd

Run

Client & Server

On two separate shells, run the client & server independently:

  1. Start server
# Shell 1
cd src/Server
dotnet run
  1. Start client
# Shell 2
cd src/Client
dotnet run

You'll then see messages being sent from the client and responses being sent from the server

Client only

To test the UDP client, start a netcat server before running the program:

cd src/Client
nc -lu 127.0.0.1 3000 &
dotnet run

Obviously the server will never respond as it's just a dumb listening socket so the client will just loop timing out.

Server only

To test the UDP server, start the server and then use a netcat udp client to send valid JSON:

cd src/Server
dotnet run &
echo -n '{"state": "connect", "id": "'$(uuidgen)'"}' | nc -u 127.0.0.1 3000

The server should respond to each valid client message issued by echo/netcat.

About

An example of JSON-over-UDP in F#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages