As title.
If a client send a file via this method,
how do I get the file with Socket.ReceiveAsync() (or other) method on my
server application?
The same way you'd receive the file were it send via any other means. For
network i/o, the API used at one end doesn't dictate the API used at the
other. As long as they are both conforming to the appropriate network
protocol, they can communicate.
In other words, the fact that the data is sent using SendPacketsAsync() is
irrelevant. The data shows up at the other end the same way regardless.
I guess the answer is about the SocketAsyncEventArgs class, but I don't
know how to do...
If you use the Socket.ReceiveAsync() method, you'll have to use the
SocketAsyncEventArgs class, yes. Otherwise, no. You could use the
Socket.Receive() method or the Socket.BeginReceive() method instead and
accomplish the same thing.
As far as "how to do" goes...the basic idea is that you need code that has
a connected socket at the receiving end, from which you'll read bytes as
they arrive. As you receive those bytes, if you want them written to a
file, you need to do that yourself (e.g. using the FileStream class).
When the transmission has been completed (indicated by whatever means you
chose when you used SendPacketsAsync()...typically you'd either preface
the file data with a length, or you'd simply let SendPacketsAsync() close
the connection when done), you close the file.
There are examples of varying quality on MSDN for how to write code that
uses the Socket class. If you have specific questions about those
examples or the documentation, you should state clearly what your specific
questions are.
Pete