fszmq


Hello World server

Binds REP socket to tcp://*:5555

Expects "Hello" from client, replies with "World"

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
#r @"fszmq.dll"
open fszmq
open fszmq.Socket
open System.Threading

let main () =
  // socket to talk to clients
  use context = new Context ()
  use responder = Context.rep context
  Socket.bind responder "tcp://*:5555"

  while true do
    // wait for next request from client
    let _buffer = Socket.recv responder
    printfn "Received Hello"

    // do some work
    Thread.Sleep 1000 // msecs

    // send reply back to client
    Socket.send responder "World"B

  0 // return code
module docs
module PATH

from docs
val hijack : unit -> unit

Full name: docs.PATH.hijack
namespace fszmq
Multiple items
module Socket

from fszmq

--------------------
namespace System
namespace System.Threading
val main : unit -> int

Full name: Hwserver.main
val context : System.IDisposable
val responder : System.IDisposable
val bind : socket:fszmq.Socket -> address:string -> unit

Full name: fszmq.Socket.bind
val recv : socket:fszmq.Socket -> byte []

Full name: fszmq.Socket.recv
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Multiple items
type Thread =
  inherit CriticalFinalizerObject
  new : start:ThreadStart -> Thread + 3 overloads
  member Abort : unit -> unit + 1 overload
  member ApartmentState : ApartmentState with get, set
  member CurrentCulture : CultureInfo with get, set
  member CurrentUICulture : CultureInfo with get, set
  member DisableComObjectEagerCleanup : unit -> unit
  member ExecutionContext : ExecutionContext
  member GetApartmentState : unit -> ApartmentState
  member GetCompressedStack : unit -> CompressedStack
  member GetHashCode : unit -> int
  ...

Full name: System.Threading.Thread

--------------------
Thread(start: ThreadStart) : unit
Thread(start: ParameterizedThreadStart) : unit
Thread(start: ThreadStart, maxStackSize: int) : unit
Thread(start: ParameterizedThreadStart, maxStackSize: int) : unit
Thread.Sleep(timeout: System.TimeSpan) : unit
Thread.Sleep(millisecondsTimeout: int) : unit
val send : socket:fszmq.Socket -> frame:byte [] -> unit

Full name: fszmq.Socket.send
val release : unit -> unit

Full name: docs.PATH.release
Fork me on GitHub