Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateFromStream() [1/2]

static WebSocket System.Net.WebSockets.WebSocket.CreateFromStream ( Stream stream,
bool isServer,
string? subProtocol,
TimeSpan keepAliveInterval )
inlinestaticinherited

Definition at line 130 of file WebSocket.cs.

131 {
132 if (stream == null)
133 {
134 throw new ArgumentNullException("stream");
135 }
136 if (!stream.CanRead || !stream.CanWrite)
137 {
138 throw new ArgumentException((!stream.CanRead) ? System.SR.NotReadableStream : System.SR.NotWriteableStream, "stream");
139 }
140 if (subProtocol != null)
141 {
142 WebSocketValidate.ValidateSubprotocol(subProtocol);
143 }
144 if (keepAliveInterval != Timeout.InfiniteTimeSpan && keepAliveInterval < TimeSpan.Zero)
145 {
146 throw new ArgumentOutOfRangeException("keepAliveInterval", keepAliveInterval, System.SR.Format(System.SR.net_WebSockets_ArgumentOutOfRange_TooSmall, 0));
147 }
148 return new ManagedWebSocket(stream, isServer, subProtocol, keepAliveInterval);
149 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string net_WebSockets_ArgumentOutOfRange_TooSmall
Definition SR.cs:146
static string NotReadableStream
Definition SR.cs:60
Definition SR.cs:7
static readonly TimeSpan InfiniteTimeSpan
Definition Timeout.cs:5

References System.SR.Format(), System.Threading.Timeout.InfiniteTimeSpan, System.SR.net_WebSockets_ArgumentOutOfRange_TooSmall, System.SR.NotReadableStream, System.SR.NotWriteableStream, System.stream, System.Net.WebSockets.WebSocketValidate.ValidateSubprotocol(), and System.TimeSpan.Zero.

Referenced by System.Net.WebSockets.WebSocketHandle.ConnectAsync().