Skip to content

Instantly share code, notes, and snippets.

@peteraritchie
Created October 12, 2012 21:15
Show Gist options
  • Save peteraritchie/3881573 to your computer and use it in GitHub Desktop.
Save peteraritchie/3881573 to your computer and use it in GitHub Desktop.
sill socket beginsend example
socket.BeginSend(memoryStream.GetBuffer(), 0,
(int) memoryStream.Length - 5, 0,
sendAr =>
{
socket.EndSend(sendAr);
socket.BeginSend(
memoryStream.GetBuffer(),
(int) memoryStream.Length - 5,
5, 0,
sendAr2 =>
{
socket.EndSend(sendAr2);
try
{
socket.Shutdown(
SocketShutdown.Both);
socket.Close();
}
catch (SocketException ex)
{
Console.WriteLine(string.Format("1: SocketException {0}, {1}", Enum.GetName(typeof(SocketError), ex.SocketErrorCode), ex.Message));
}
catch (Exception ex)
{
.WriteLine(string.Format("1: {0}, {1}", ex.GetType().Name, ex.Message));
}
}, null);
}, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment