FSharp.FIO.Sockets
0.4.0-beta
dotnet add package FSharp.FIO.Sockets --version 0.4.0-beta
NuGet\Install-Package FSharp.FIO.Sockets -Version 0.4.0-beta
<PackageReference Include="FSharp.FIO.Sockets" Version="0.4.0-beta" />
<PackageVersion Include="FSharp.FIO.Sockets" Version="0.4.0-beta" />
<PackageReference Include="FSharp.FIO.Sockets" />
paket add FSharp.FIO.Sockets --version 0.4.0-beta
#r "nuget: FSharp.FIO.Sockets, 0.4.0-beta"
#:package FSharp.FIO.Sockets@0.4.0-beta
#addin nuget:?package=FSharp.FIO.Sockets&version=0.4.0-beta&prerelease
#tool nuget:?package=FSharp.FIO.Sockets&version=0.4.0-beta&prerelease
FIO.Sockets
TCP sockets for FIO. Connect, send, and receive as composable
effects — connections are scoped and released for you, and failures surface as a typed
SocketError rather than raw exceptions.
- Client connections —
SocketClient.withConnectionTo/withConnectionscope a socket's lifetime - Server —
ServerSocket.bind/accept/closefor manual control, orServerSocket.serve/acceptLoopto run a handler per connection with bounded concurrency, closing the server when interrupted - Custom codecs — send and receive typed messages, not just strings
Install
dotnet add package FSharp.FIO.Sockets
Quick Start
open FIO.DSL
open FIO.Sockets
let program =
SocketClient.withConnectionTo "localhost" 8080 (fun socket ->
fio {
do! socket.SendString "Hello, server!"
return! socket.ReceiveString 1024
})
Server
open FIO.DSL
open FIO.Sockets
let server = fio {
let! config = ServerSocketConfig.create "localhost" 8080
let! serverSocket = ServerSocket.bind config
let! clientSocket = ServerSocket.accept serverSocket
let! message = clientSocket.ReceiveString 1024
do! clientSocket.SendString $"echo: {message}"
do! ServerSocket.close serverSocket
}
Errors
Operations fail with a typed SocketError — ConnectionFailed, ConnectionClosed, SendFailed,
ReceiveFailed, TimeoutError, BufferOverflow, InvalidState, BindFailed, AcceptFailed,
CodecError, GeneralError — with SocketError.fromException / SocketError.toException to
bridge raw exceptions. InvalidState also covers argument validation (an empty host, a port out
of range, a non-positive buffer size); BufferOverflow is raised when a line or frame exceeds the
buffer you passed.
Connection pooling is not implemented yet: SocketPoolConfig and the PoolExhausted / PoolClosed
error cases are reserved for it and are not produced by any current operation.
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Core (>= 10.1.401)
- FSharp.FIO (>= 0.4.0-beta)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.0-beta | 66 | 9/17/2026 |
| 0.3.0-beta | 65 | 9/11/2026 |
| 0.2.2-beta | 84 | 7/12/2026 |
| 0.2.1-beta | 77 | 7/9/2026 |
| 0.2.0-beta | 85 | 7/6/2026 |
| 0.1.15-alpha | 87 | 6/30/2026 |
| 0.1.10-alpha | 79 | 6/24/2026 |
| 0.1.0-alpha | 98 | 6/18/2026 |