Send a file in C# client-server application -


I have a socket-based server and I want to send a file from that server for all to connect to server side

  tcpClient.Client.SendFile (filename)  

But how can I separate this message on customer message? It should be that the use of normal communication protocols is based on XML, and for example sending the txt file it will not be parsed. What is a way to capture a file using "SendFile" on the client side?

Programming at the socket level below, you need to create your own protocol. For example, you can decide that the client will send commands like "FILE file.typ \ n" to the server. When the server sees this command, it is expected to see the number of bytes in the file as "nnnnnn \ n". After this, it will expect the contents of the file of the next "NNNNN" bytes.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -