Send a file from server to client vis stream (Full Version)

All Forums >> [.NET Compact Framework Development] >> .NET Compact Framework - VB.NET



Message


ymahmood -> Send a file from server to client vis stream (3/17/2008 8:17:54 AM)

hi,

I currently have a client server app which passes back and forth String data and it works great. but now i have the need to send non text files ie images from server to client (PPC). It is all based on system.net.sockets.


The client is making a request via the following

Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(lData)
lnetworkStream.Write(sendBytes, 0, sendBytes.Length)
Dim bytes(ltcpClient.ReceiveBufferSize) As Byte

lnetworkStream.Read(bytes, 0,
CInt(ltcpClient.ReceiveBufferSize))
Dim returndata As String = Encoding.ASCII.GetString(bytes, 0, bytes.Length)

 



The server code is responding via the following .

Private Sub sendmessage(ByVal s As Socket, ByVal message As String)
Buffer =
New [Byte](message.Length + 1) {}
Dim length As Integer = ASCII.GetBytes(message, 0, message.Length, Buffer, 0)
s.Send(Buffer, length, 0)
End Sub 'sendmessag
 
Can any one one help, i can't seem to find any help on sending files via sockets.

thanks in advance




Page: [1]



Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.016