hi all..
can any one help in sending a image captured by webcam using an C# windows application to another computer and display it in another C# windows application running in that computer..
thanks in advance..
can any one help in sending a image captured by webcam using an C# windows application to another computer and display it in another C# windows application running in that computer..
thanks in advance..

Pramod Kumar NandagiriPosted Sep 17, 2009, 1:10 AM
I tried the same code which u have given by downloading it form the net and the file are transferred successfully but when coming to images
image is transferred but not the full image only a 10% of image is transfered and the remailning part is just in black shape
could u please help me on this
Some times image is transferred and saved to my c drive and when i opened it,it showed the message :drawing failed....
Master BillaPosted Sep 16, 2009, 10:49 AM
We can use the socket to this
class FTClientCode
{
public static void SendFile(string fileName)
{
try
{
IPAddress[] ipAddress = Dns.GetHostAddresses("localhost");
IPEndPoint ipEnd = new IPEndPoint(ipAddress[0], 5656);
Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
string filePath = "";
fileName = fileName.Replace("\\", "/");
while (fileName.IndexOf("/") > -1)
{
filePath += fileName.Substring(0, fileName.IndexOf("/") + 1);
fileName = fileName.Substring(fileName.IndexOf("/") + 1);
}
byte[] fileNameByte = Encoding.ASCII.GetBytes(fileName);
if (fileNameByte.Length > 850 * 1024)
{
curMsg = "File size is more than 850kb, please try with small file.";
return;
}
//byte[] clientData = new byte[12 + fileNameByte.Length + fileData.Length];
byte[] fileNameLen = BitConverter.GetBytes(fileNameByte.Length);
byte[] message = Encoding.ASCII.GetBytes("image_ok");
fileNameLen.CopyTo(clientData, 0);
fileNameByte.CopyTo(clientData, 4);
fileData.CopyTo(clientData, 4 + fileNameByte.Length);
message.CopyTo(clientData, fileNameByte.Length + fileData.Length);}
}
clientSock.Connect(ipEnd);
clientSock.Send(clientData);
clientSock.Close();
}
}
Thank you