C# Class BlottoBeats.Library.Networking.Message

Message helper class for to clog the tubes with. Use Message.Send() to send a message and Message.Receive() to receive it. Used to send and receive objects directly.
Show file Open project: Zwolf11/BlottoBeats

Public Methods

Method Description
Pack ( object obj ) : byte[]

Packs an object into a big-endian byte array

Recieve ( NetworkStream stream ) : object

Receieves a single object over the specified stream

Send ( NetworkStream stream, object obj ) : void

Sends a single object over the specified stream

Test ( NetworkStream stream ) : bool

Tests a connection to see if it is valid

TestMsg ( NetworkStream stream ) : void

Sends a blank message with length header of zero.

Unpack ( byte data ) : object

Unpacks a big-endian byte array into an object

Method Details

Pack() public static method

Packs an object into a big-endian byte array
public static Pack ( object obj ) : byte[]
obj object Object to pack
return byte[]

Recieve() public static method

Receieves a single object over the specified stream
public static Recieve ( NetworkStream stream ) : object
stream System.Net.Sockets.NetworkStream Stream to receive the message from
return object

Send() public static method

Sends a single object over the specified stream
public static Send ( NetworkStream stream, object obj ) : void
stream System.Net.Sockets.NetworkStream Stream to send the message over
obj object Object to send
return void

Test() public static method

Tests a connection to see if it is valid
public static Test ( NetworkStream stream ) : bool
stream System.Net.Sockets.NetworkStream Stream to test
return bool

TestMsg() public static method

Sends a blank message with length header of zero.
public static TestMsg ( NetworkStream stream ) : void
stream System.Net.Sockets.NetworkStream
return void

Unpack() public static method

Unpacks a big-endian byte array into an object
public static Unpack ( byte data ) : object
data byte
return object