0 bytes?

  • Thread starter Thread starter Paulo
  • Start date Start date
P

Paulo

using System.Net.Sockets;

public bool SendBytesToPrinter(byte[] p)
{
try
{
Socket socket;
using (socket = new Socket(
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
SocketError clsError;
socket.Connect("localhost", 123);
socket.Send(p, 0, p.Length, SocketFlags.None, out clsError);
socket.Close();
}
return true;
}
catch (Exception e)
{
Response.Write(e.Message);
//TODO: do something with exception
return false;
}
}

----------------------------------------------------
ButtonClick
byte[] bMessage = System.Text.Encoding.ASCII.GetBytes("testando!");
if (SendBytesToPrinter(bMessage))
{
Response.Write("Data sent!");
}

Why my VB 6 app WinSock control DataArrival event returns 0 byte?

Thanks
Something wrong with VB or asp.net 2.0 C# VS 2005?
 
Back
Top