Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
hi, i want write windows service that using asynchronous socket server and client side will be windows form.

http://msdn.microsoft.com/en-us/library/bew39x2a.aspx[^]

http://msdn.microsoft.com/en-us/library/fx6588te.aspx[^]

There are example in msdn but they just send text... I want send and recieve any size files...

How can i use that socket.sendfile and socket.beginsendfile methods....
Posted

1 solution

Hi,u got right msdn link. If u implement core logic u can get file of any length with proper socket connection. U have to convert respective file into byte array and send that file over socket. Now buffer size is tricky thing u have to use Redim or use Arraylist class of .net (easily available articles on net), so u can reuse them.
One more thing u have to use loop which will read all sent file bytes till end of buffer.Store these bytes in one target array of bytes (target),then convert this bytes in file.
Right now i m busy with my stuff.If i get time i will try to post solution with code or link from my old stuff.
This all things u can find easily on internet in parts.
-- Good luck
 
Share this answer
 
Comments
Deuojen 7-Dec-12 6:05am    
thank you for answer, i will work on it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900