TCPClient/TCPServer Send function over buffer size not sent

Jan 6, 2012 at 7:17 AM

Look at this example :

//Message Struct

[Serializable]
public class Message : MessageObject {
public Message(): base() {}
public Message(Command _cmd) { cmd = _cmd; }
public Command cmd;
public byte[] bytedata;
}

//Client Side

Message msg =  new Message(Command.ConnectWelcome);
msg.bytedata= System.IO.File.ReadAllBytes("C:\\1.mp3"); // his byte.Length is More then 100000;
if (m_TCPClient.Send(msg)) { Log("Sent"); } else { Log("Not Sent"); } 

ive used your lib for testing in my project
ive create my own Messsage structure. and ive added a field in it, that take byte[] data directly  (bytedata) ;
Now after Sending the Log result me : "Sent" 
But in the Server side (TCPServer_OnMessageReceived) not detect any recieved message ! (The function not triggered at all )
(in smaller message the solution works fine) 

Any solution for this issue ?
There is any other possible way to use this TCPServer as File server ?

Coordinator
Jan 6, 2012 at 8:07 AM

Hi there,

I think I understand what you are trying to do but this library is certainly not what you're looking for. If you wait long enough the message will probably come through but sending suuuch a large amount of data takes a veeerryy long time for TCP to transfer. In essence you should not be using TCP for file transfer! You should use FTP for file transfer between servers/clients. If you are trying to run a file server, use TCP for any small communication like commands but FTP for any actual file transfer. FTP stands for File Transfer Protocol....

Sorry I cannot help you directly, but I know I have seen a number of FTP Libraries on Codeplex, just search FTP. If you like you can put FTP on the Wish List.

Regards,
Ed