Transfer file with socket in vb.net 2005 ?

h.abedijoo

New member
Joined
Jan 24, 2006
Messages
3
Programming Experience
3-5
hi to all .

i need a sample about transfer files with socket in vb.net 2005 ?(client/server)
i have a sample code with vb.net 2003 . but i do not know why it does not work after to update to 2005 .

pls see it and guide me .
The file attached .

Thanks alot .
 

Attachments

  • A_Winsock_608703102002.zip
    34.9 KB · Views: 100
Using Winsock In VB.NET

This Code uses the winsock control. I would recommecnd you learn how to use the socket class(s) in .net. The problem you are experiancing however is very simple.

In the form "File Transfer Send.vb", you have two errors. These relate to the winsock controls "State". You have coded:
=== CODE ===

PrivateSub wsSend_ConnectionRequest(ByVal sender AsObject, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles wsSend.ConnectionRequest

If wsSend.State <> MSWinsockLib.StateConstants.sckClosed Then
wsSend.Close()
EndIf

wsSend.Accept(e.requestID)
If wsSend.State = MSWinsockLib.StateConstants.sckConnected Then
Call WsSendConnected()
EndIf

EndSub

=== End Code ===

Simply Change the wsSend.State to wsSend.ctlState :)

Kingi

 
As far as i know it only really works with websites, For simple one2one File transfers i recommecnd using a tcplistener and client. Thius will allow u more control over your transfer.
 
Back
Top