mpst_rust_github
mpst_rust_github copied to clipboard
Some issues understanding tcp example
Hi, this might not be soi much of an issue, but maybe more a problem of understanding. A little context first. I'm doing a project, where we should have an implementation of a specific protocol, that uses session types for the communication of two devices, on a network.
So, as a consequence of this, I was interested in looking at the tcp/client/server example of this page. Other session types repo's that I have been looking at have'nt had examples where session types was actually used by two processes acting away from each other.
And I had a hard time conceptually understanding how session types would work over a connection, since the definition of parties could not be in the same file, since the endpoints are usually run together by using fork_mpst
So I was thrilled to see your tcp example, in the example/tcp_and_others
folder. And I have now studied it for a bit.
But it seems to me like the files in that folder does'nt actually use the session type specified in this library. The other examples in this repo follows the structure described in the README
of the repo, defining roles and sending and receiving function with use mpstthree
, but in the tcp example, another library called crossbeam_channel
, which seems to be a more general.
So, is it possible to use the session types that this library uses over a connection? or maybe i'm completely misunderstanding the examples given
Hi, the TCP and UDP features are not complete yet and I will not work on them in the near future.
The current TCP example works in two files: TCP server and TCP client. Currently, the basic protocol is hard coded in both files: the client connects to the server, then send a random message before receiving the same one appended after a "Reply is ok!: ", if everything goes right, and "Unexpected reply: " else.
If I actually used session types for this protocol, the two entities should first agree on the protocol to use, and then, they should closely follow it. The agreement of protocol can either be decided via hard coding before the communication, such as "if I use this port, it means that I will use this protocol", or agreed during handshake, but this implies that there is already a hard coded agreement protocol.