You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you start one mdo-cli with a --server command-line argument (server)
you start another mdo-cli without that argument (client)
the client connects to the server, and sends it a username (ExampleUsername for now)
the server logs that connected username to the console
the server sends out that username to all of the already connected clients
the clients log out that username
There's no immediate need to use an advanced protocol definition format like FlatBuffers, so for this basic demo, sending simple strings in packets is fine. Remember to appropriately handle null termination.
Other than the --serverless flag passed to the CLI to select whether the server or the client is running, there's no need to provide any other configuration to the CLI to get a basic networking demo working. That can be figured out in a future issue. For now, hardcoding a localhost address and port, and using a hard username like ExampleUsername is fine.
Physical implementation:
create network_client and network_server objects:
include/network/network_server.h
include/network/network_client.h
src/network/network_server.c
src/network/network_client.c
use libuv in network_server to listen on a localhost port, handle incoming clients and safely handle remote hang-ups
format and log strings received by network_server (like "ExampleUsername connected") and broadcast them back out to clients
use libuv in network_client to connect to a localhostport, and log received strings
in cli/main.c, scan the arguments for --serverless using strcmp(), and initialize either network_server or network_client depending on presence of the flag
The text was updated successfully, but these errors were encountered:
Here's a bare minimum network story:
mdo-cli
with a--server
command-line argument (server)mdo-cli
without that argument (client)ExampleUsername
for now)There's no immediate need to use an advanced protocol definition format like FlatBuffers, so for this basic demo, sending simple strings in packets is fine. Remember to appropriately handle null termination.
Other than the
--serverless
flag passed to the CLI to select whether the server or the client is running, there's no need to provide any other configuration to the CLI to get a basic networking demo working. That can be figured out in a future issue. For now, hardcoding alocalhost
address and port, and using a hard username likeExampleUsername
is fine.Physical implementation:
network_client
andnetwork_server
objects:include/network/network_server.h
include/network/network_client.h
src/network/network_server.c
src/network/network_client.c
network_server
to listen on alocalhost
port, handle incoming clients and safely handle remote hang-upsnetwork_server
(like "ExampleUsername connected") and broadcast them back out to clientsnetwork_client
to connect to alocalhost
port, and log received stringscli/main.c
, scan the arguments for--serverless
usingstrcmp()
, and initialize eithernetwork_server
ornetwork_client
depending on presence of the flagThe text was updated successfully, but these errors were encountered: