0 bytes?

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top