2 people like it.

Async extensions for Socket

Async extensions for Socket. This extensions use SocketAsyncEventArgs, not Begin / End pattern.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
module Sayuri.Net.SocketExtensions
open System
open System.Net
open System.Net.Sockets

#if NET4
type private ConcurrentBag<'T> = System.Collections.Concurrent.ConcurrentBag<'T>
#else
type private ConcurrentBag<'T>() =
    let bag = System.Collections.Generic.Stack<'T>()
    member this.TryTake() =
        lock bag (fun () -> if 0 < bag.Count then true, bag.Pop() else false, Unchecked.defaultof<_>)
    member this.Add(item) =
        lock bag (fun () -> bag.Push item)
#endif

let inline private checkNonNull name arg =
    match box arg with null -> nullArg name | _ -> ()


let private pool = ConcurrentBag()

let private invoke methodAsync prepare result = async {
    let e = match pool.TryTake() with
            | true, e  -> e
            | false, _ -> new SocketAsyncEventArgs()
    try
        prepare e
        return! Async.FromContinuations(fun (cont, econt, _) ->
            let called = ref 0
            let completed (e : SocketAsyncEventArgs) =
                assert(System.Threading.Interlocked.Increment called = 1)
                (e.UserToken :?> IDisposable).Dispose()
#if NET4
                if e.ConnectByNameError <> null then econt e.ConnectByNameError else
#endif
                if e.SocketError <> SocketError.Success then new SocketException(int e.SocketError) |> econt else
                result e |> cont
            e.UserToken <- e.Completed.Subscribe completed
            if methodAsync e |> not then completed e
        )
    finally
        e.AcceptSocket <- null
        e.BufferList <- null
        e.RemoteEndPoint <- null
        e.SocketFlags <- SocketFlags.None
        e.UserToken <- null
        e.SetBuffer(null, 0, 0)
        pool.Add(e)
    }

let private setBuffer buffer offset count (e : SocketAsyncEventArgs) =
    let offset = defaultArg offset 0
    let count = defaultArg count (Array.length buffer - offset)
    e.SetBuffer(buffer, offset, count)

type Socket with 
    member this.AsyncAccept() =
        invoke this.AcceptAsync
            ignore
            (fun e -> e.AcceptSocket)
    member this.AsyncAccept(buffer, ?offset, ?count) =
        invoke this.AcceptAsync
            (fun e -> setBuffer buffer offset count e
                      assert ((this.LocalEndPoint.Serialize().Size + 16) * 2 < e.Count))    // test buffer size.
            (fun e -> e.AcceptSocket, e.BytesTransferred)
    member this.AsyncAccept(acceptSocket) =
        checkNonNull "acceptSocket" acceptSocket
        invoke this.AcceptAsync
            (fun e -> e.AcceptSocket <- acceptSocket)
            ignore
    member this.AsyncAccept(acceptSocket, buffer, ?offset, ?count) =
        checkNonNull "acceptSocket" acceptSocket
        checkNonNull "buffer" buffer
        invoke this.AcceptAsync
            (fun e -> setBuffer buffer offset count e
                      assert ((this.LocalEndPoint.Serialize().Size + 16) * 2 < e.Count)     // test buffer size.
                      e.AcceptSocket <- acceptSocket)
            (fun e -> e.BytesTransferred)
    member this.AsyncConnect(remoteEndPoint) =
        checkNonNull "remoteEndPoint" remoteEndPoint
        invoke this.ConnectAsync
            (fun e -> e.RemoteEndPoint <- remoteEndPoint)
            ignore
    member this.AsyncConnect(remoteEndPoint, buffer, ?offset, ?count) =
        checkNonNull "remoteEndPoint" remoteEndPoint
        checkNonNull "buffer" buffer
        invoke this.ConnectAsync
            (fun e -> setBuffer buffer offset count e
                      e.RemoteEndPoint <- remoteEndPoint)
            (fun e -> e.BytesTransferred)
    member this.AsyncConnect(host, port) =
        checkNonNull "host" host
        if port < IPEndPoint.MinPort || IPEndPoint.MaxPort < port then ArgumentOutOfRangeException "port" |> raise
#if NET4
        invoke this.ConnectAsync
            (fun e -> e.RemoteEndPoint <- DnsEndPoint(host, port))
            ignore
#else
        Async.FromBeginEnd<string, _, _>(host, port, this.BeginConnect, this.EndConnect)
#endif
    member this.AsyncDisconnect(reuseSocket) =
        invoke this.DisconnectAsync
            (fun e -> e.DisconnectReuseSocket <- reuseSocket)
            ignore
    member this.AsyncReceive(buffer, ?offset, ?count, ?socketFlags) =
        checkNonNull "buffer" buffer
        invoke this.ReceiveAsync
            (fun e -> setBuffer buffer offset count e
                      e.SocketFlags <- defaultArg socketFlags SocketFlags.None)
            (fun e -> e.BytesTransferred)
    member this.AsyncReceive(bufferList, ?socketFlags) =
        checkNonNull "bufferList" bufferList
        invoke this.ReceiveAsync
            (fun e -> e.BufferList <- bufferList
                      e.SocketFlags <- defaultArg socketFlags SocketFlags.None)
            (fun e -> e.BytesTransferred)
    member this.AsyncSend(buffer, ?offset, ?count, ?socketFlags) =
        checkNonNull "buffer" buffer
        invoke this.SendAsync
            (fun e -> setBuffer buffer offset count e
                      e.SocketFlags <- defaultArg socketFlags SocketFlags.None)
            (fun e -> e.BytesTransferred)
    member this.AsyncSend(bufferList, ?socketFlags) =
        checkNonNull "bufferList" bufferList
        invoke this.SendAsync
            (fun e -> e.BufferList <- bufferList
                      e.SocketFlags <- defaultArg socketFlags SocketFlags.None)
            (fun e -> e.BytesTransferred)
namespace Sayuri
namespace Sayuri.Net
module SocketExtensions

from Sayuri.Net
namespace System
namespace System.Net
namespace System.Net.Sockets
Multiple items
type private ConcurrentBag<'T> =
  new : unit -> ConcurrentBag<'T>
  member Add : item:'T -> unit
  member TryTake : unit -> bool * 'T

Full name: Sayuri.Net.SocketExtensions.ConcurrentBag<_>

--------------------
private new : unit -> ConcurrentBag<'T>
val bag : Collections.Generic.Stack<'T>
namespace System.Collections
namespace System.Collections.Generic
Multiple items
type Stack<'T> =
  new : unit -> Stack<'T> + 2 overloads
  member Clear : unit -> unit
  member Contains : item:'T -> bool
  member CopyTo : array:'T[] * arrayIndex:int -> unit
  member Count : int
  member GetEnumerator : unit -> Enumerator<'T>
  member Peek : unit -> 'T
  member Pop : unit -> 'T
  member Push : item:'T -> unit
  member ToArray : unit -> 'T[]
  ...
  nested type Enumerator

Full name: System.Collections.Generic.Stack<_>

--------------------
Collections.Generic.Stack() : unit
Collections.Generic.Stack(capacity: int) : unit
Collections.Generic.Stack(collection: Collections.Generic.IEnumerable<'T>) : unit
val this : ConcurrentBag<'T>
member private ConcurrentBag.TryTake : unit -> bool * 'T

Full name: Sayuri.Net.SocketExtensions.ConcurrentBag`1.TryTake
val lock : lockObject:'Lock -> action:(unit -> 'T) -> 'T (requires reference type)

Full name: Microsoft.FSharp.Core.Operators.lock
property Collections.Generic.Stack.Count: int
Collections.Generic.Stack.Pop() : 'T
module Unchecked

from Microsoft.FSharp.Core.Operators
val defaultof<'T> : 'T

Full name: Microsoft.FSharp.Core.Operators.Unchecked.defaultof
member private ConcurrentBag.Add : item:'T -> unit

Full name: Sayuri.Net.SocketExtensions.ConcurrentBag`1.Add
val item : 'T
Collections.Generic.Stack.Push(item: 'T) : unit
val private checkNonNull : name:string -> arg:'a -> unit

Full name: Sayuri.Net.SocketExtensions.checkNonNull
val name : string
val arg : 'a
val box : value:'T -> obj

Full name: Microsoft.FSharp.Core.Operators.box
val nullArg : argumentName:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.nullArg
val private pool : ConcurrentBag<SocketAsyncEventArgs>

Full name: Sayuri.Net.SocketExtensions.pool
val private invoke : methodAsync:(SocketAsyncEventArgs -> bool) -> prepare:(SocketAsyncEventArgs -> unit) -> result:(SocketAsyncEventArgs -> 'a) -> Async<'a>

Full name: Sayuri.Net.SocketExtensions.invoke
val methodAsync : (SocketAsyncEventArgs -> bool)
val prepare : (SocketAsyncEventArgs -> unit)
val result : (SocketAsyncEventArgs -> 'a)
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val e : SocketAsyncEventArgs
member private ConcurrentBag.TryTake : unit -> bool * 'T
Multiple items
type SocketAsyncEventArgs =
  inherit EventArgs
  new : unit -> SocketAsyncEventArgs
  member AcceptSocket : Socket with get, set
  member Buffer : byte[]
  member BufferList : IList<ArraySegment<byte>> with get, set
  member BytesTransferred : int
  member ConnectByNameError : Exception
  member ConnectSocket : Socket
  member Count : int
  member DisconnectReuseSocket : bool with get, set
  member Dispose : unit -> unit
  ...

Full name: System.Net.Sockets.SocketAsyncEventArgs

--------------------
SocketAsyncEventArgs() : unit
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
val cont : ('a -> unit)
val econt : (exn -> unit)
val called : int ref
Multiple items
val ref : value:'T -> 'T ref

Full name: Microsoft.FSharp.Core.Operators.ref

--------------------
type 'T ref = Ref<'T>

Full name: Microsoft.FSharp.Core.ref<_>
val completed : (SocketAsyncEventArgs -> unit)
namespace System.Threading
type Interlocked =
  static member Add : location1:int * value:int -> int + 1 overload
  static member CompareExchange : location1:int * value:int * comparand:int -> int + 6 overloads
  static member Decrement : location:int -> int + 1 overload
  static member Exchange : location1:int * value:int -> int + 6 overloads
  static member Increment : location:int -> int + 1 overload
  static member Read : location:int64 -> int64

Full name: System.Threading.Interlocked
Threading.Interlocked.Increment(location: byref<int64>) : int64
Threading.Interlocked.Increment(location: byref<int>) : int
property SocketAsyncEventArgs.UserToken: obj
type IDisposable =
  member Dispose : unit -> unit

Full name: System.IDisposable
property SocketAsyncEventArgs.SocketError: SocketError
type SocketError =
  | Success = 0
  | SocketError = -1
  | Interrupted = 10004
  | AccessDenied = 10013
  | Fault = 10014
  | InvalidArgument = 10022
  | TooManyOpenSockets = 10024
  | WouldBlock = 10035
  | InProgress = 10036
  | AlreadyInProgress = 10037
  ...

Full name: System.Net.Sockets.SocketError
field SocketError.Success = 0
Multiple items
type SocketException =
  inherit Win32Exception
  new : unit -> SocketException + 1 overload
  member ErrorCode : int
  member Message : string
  member SocketErrorCode : SocketError

Full name: System.Net.Sockets.SocketException

--------------------
SocketException() : unit
SocketException(errorCode: int) : unit
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
event SocketAsyncEventArgs.Completed: IEvent<EventHandler<SocketAsyncEventArgs>,SocketAsyncEventArgs>
member IObservable.Subscribe : callback:('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<SocketAsyncEventArgs>) : IDisposable
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
property SocketAsyncEventArgs.AcceptSocket: Socket
property SocketAsyncEventArgs.BufferList: Collections.Generic.IList<ArraySegment<byte>>
property SocketAsyncEventArgs.RemoteEndPoint: EndPoint
property SocketAsyncEventArgs.SocketFlags: SocketFlags
type SocketFlags =
  | None = 0
  | OutOfBand = 1
  | Peek = 2
  | DontRoute = 4
  | MaxIOVectorLength = 16
  | Truncated = 256
  | ControlDataTruncated = 512
  | Broadcast = 1024
  | Multicast = 2048
  | Partial = 32768

Full name: System.Net.Sockets.SocketFlags
field SocketFlags.None = 0
SocketAsyncEventArgs.SetBuffer(offset: int, count: int) : unit
SocketAsyncEventArgs.SetBuffer(buffer: byte [], offset: int, count: int) : unit
member private ConcurrentBag.Add : item:'T -> unit
val private setBuffer : buffer:byte [] -> offset:int option -> count:int option -> e:SocketAsyncEventArgs -> unit

Full name: Sayuri.Net.SocketExtensions.setBuffer
val buffer : byte []
val offset : int option
val count : int option
val offset : int
val defaultArg : arg:'T option -> defaultValue:'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.defaultArg
val count : int
type Array =
  member Clone : unit -> obj
  member CopyTo : array:Array * index:int -> unit + 1 overload
  member GetEnumerator : unit -> IEnumerator
  member GetLength : dimension:int -> int
  member GetLongLength : dimension:int -> int64
  member GetLowerBound : dimension:int -> int
  member GetUpperBound : dimension:int -> int
  member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
  member Initialize : unit -> unit
  member IsFixedSize : bool
  ...

Full name: System.Array
val length : array:'T [] -> int

Full name: Microsoft.FSharp.Collections.Array.length
Multiple items
type Socket =
  new : socketInformation:SocketInformation -> Socket + 1 overload
  member Accept : unit -> Socket
  member AcceptAsync : e:SocketAsyncEventArgs -> bool
  member AddressFamily : AddressFamily
  member Available : int
  member BeginAccept : callback:AsyncCallback * state:obj -> IAsyncResult + 2 overloads
  member BeginConnect : remoteEP:EndPoint * callback:AsyncCallback * state:obj -> IAsyncResult + 3 overloads
  member BeginDisconnect : reuseSocket:bool * callback:AsyncCallback * state:obj -> IAsyncResult
  member BeginReceive : buffers:IList<ArraySegment<byte>> * socketFlags:SocketFlags * callback:AsyncCallback * state:obj -> IAsyncResult + 3 overloads
  member BeginReceiveFrom : buffer:byte[] * offset:int * size:int * socketFlags:SocketFlags * remoteEP:EndPoint * callback:AsyncCallback * state:obj -> IAsyncResult
  ...

Full name: System.Net.Sockets.Socket

--------------------
Socket(socketInformation: SocketInformation) : unit
Socket(addressFamily: AddressFamily, socketType: SocketType, protocolType: ProtocolType) : unit
val this : Socket
member Socket.AsyncAccept : unit -> Async<Socket>

Full name: Sayuri.Net.SocketExtensions.AsyncAccept
Socket.AcceptAsync(e: SocketAsyncEventArgs) : bool
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
member Socket.AsyncAccept : buffer:byte [] * ?offset:int * ?count:int -> Async<Socket * int>

Full name: Sayuri.Net.SocketExtensions.AsyncAccept
property Socket.LocalEndPoint: EndPoint
EndPoint.Serialize() : SocketAddress
property SocketAsyncEventArgs.Count: int
property SocketAsyncEventArgs.BytesTransferred: int
member Socket.AsyncAccept : acceptSocket:Socket -> Async<unit>

Full name: Sayuri.Net.SocketExtensions.AsyncAccept
val acceptSocket : Socket
member Socket.AsyncAccept : acceptSocket:Socket * buffer:byte [] * ?offset:int * ?count:int -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncAccept
member Socket.AsyncConnect : remoteEndPoint:EndPoint -> Async<unit>

Full name: Sayuri.Net.SocketExtensions.AsyncConnect
val remoteEndPoint : EndPoint
Socket.ConnectAsync(e: SocketAsyncEventArgs) : bool
member Socket.AsyncConnect : remoteEndPoint:EndPoint * buffer:byte [] * ?offset:int * ?count:int -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncConnect
member Socket.AsyncConnect : host:string * port:int -> Async<unit>

Full name: Sayuri.Net.SocketExtensions.AsyncConnect
val host : string
val port : int
Multiple items
type IPEndPoint =
  inherit EndPoint
  new : address:int64 * port:int -> IPEndPoint + 1 overload
  member Address : IPAddress with get, set
  member AddressFamily : AddressFamily
  member Create : socketAddress:SocketAddress -> EndPoint
  member Equals : comparand:obj -> bool
  member GetHashCode : unit -> int
  member Port : int with get, set
  member Serialize : unit -> SocketAddress
  member ToString : unit -> string
  static val MinPort : int
  ...

Full name: System.Net.IPEndPoint

--------------------
IPEndPoint(address: int64, port: int) : unit
IPEndPoint(address: IPAddress, port: int) : unit
field IPEndPoint.MinPort = 0
field IPEndPoint.MaxPort = 65535
Multiple items
type ArgumentOutOfRangeException =
  inherit ArgumentException
  new : unit -> ArgumentOutOfRangeException + 4 overloads
  member ActualValue : obj
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member Message : string

Full name: System.ArgumentOutOfRangeException

--------------------
ArgumentOutOfRangeException() : unit
ArgumentOutOfRangeException(paramName: string) : unit
ArgumentOutOfRangeException(paramName: string, message: string) : unit
ArgumentOutOfRangeException(message: string, innerException: exn) : unit
ArgumentOutOfRangeException(paramName: string, actualValue: obj, message: string) : unit
val raise : exn:Exception -> 'T

Full name: Microsoft.FSharp.Core.Operators.raise
static member Async.FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member Async.FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
Socket.BeginConnect(remoteEP: EndPoint, callback: AsyncCallback, state: obj) : IAsyncResult
Socket.BeginConnect(addresses: IPAddress [], port: int, requestCallback: AsyncCallback, state: obj) : IAsyncResult
Socket.BeginConnect(address: IPAddress, port: int, requestCallback: AsyncCallback, state: obj) : IAsyncResult
Socket.BeginConnect(host: string, port: int, requestCallback: AsyncCallback, state: obj) : IAsyncResult
Socket.EndConnect(asyncResult: IAsyncResult) : unit
member Socket.AsyncDisconnect : reuseSocket:bool -> Async<unit>

Full name: Sayuri.Net.SocketExtensions.AsyncDisconnect
val reuseSocket : bool
Socket.DisconnectAsync(e: SocketAsyncEventArgs) : bool
property SocketAsyncEventArgs.DisconnectReuseSocket: bool
member Socket.AsyncReceive : buffer:byte [] * ?offset:int * ?count:int * ?socketFlags:SocketFlags -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncReceive
val socketFlags : SocketFlags option
Socket.ReceiveAsync(e: SocketAsyncEventArgs) : bool
member Socket.AsyncReceive : bufferList:Collections.Generic.IList<ArraySegment<byte>> * ?socketFlags:SocketFlags -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncReceive
val bufferList : Collections.Generic.IList<ArraySegment<byte>>
member Socket.AsyncSend : buffer:byte [] * ?offset:int * ?count:int * ?socketFlags:SocketFlags -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncSend
Socket.SendAsync(e: SocketAsyncEventArgs) : bool
member Socket.AsyncSend : bufferList:Collections.Generic.IList<ArraySegment<byte>> * ?socketFlags:SocketFlags -> Async<int>

Full name: Sayuri.Net.SocketExtensions.AsyncSend
Raw view New version

More information

Link:http://fssnip.net/px
Posted:2 years ago
Author:sayuri
Tags: async , socket , networking , socketasynceventargs