Reagent tcp

Justs simple tcp socket. No serialization, operates by raw bytes.

Syntax: reagent[`tcp;arg]

Whеre arg is one of:

  • string of format "host:port" to connect to
  • reagent tcp (does nothing since it is already an tcp)

Server example:

listener: reagent[`listener;""];
spawn {
    react {[cli:listener]
        react {[x:cli] println["\nclient request: %";x]; cli[0x vs ts[]]}

Client example:

o)cli: reagent[`tcp;""];
o)react {[x:cli] println["server response in % ms";(ts[]-0p sv x)%1000000]};
client request: 0x0102030405
server response in 0 ms