hello , this is the first time i come here , i m checking the website hours ago :P it's really gr8 keep the good work guys
i m a vb beginner i m using vb6 and i start using winsock latly (minutes ago)
i read some tutorials on the net and i made this little program but the problem is that it's not working :S . here the code
thanks in advance
Private Sub Command1_Click()
host = InputBox("Enter the host's computer name or ip address:")
Port = InputBox("Enter the host's port to connect to:")
Winsock1.Connect host, Port
End Sub
Private Sub Command2_Click()
Port = InputBox("What port do you want to host on?")
Winsock1.LocalPort = Port
Winsock1.Listen
End Sub
Private Sub Command3_Click()
Text = InputBox("Send what text?")
Winsock1.SendData Text
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.Accept RequestID
End Sub
Private Sub winsock1_RecieveData(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.GetData Data
MsgBox Data
End Sub
Thanks Spiv problem solved
this is the first time i use winsock other than localhostname and ip :P it looks really cool . i have a little question about sending files by winsock , can i send files in ole to another user ?
woow , the last one was gr8 winsock rocks i didn't understand the whole codes about sending the file but i saw how it works , i m still new in vb i start months ago . anyway i m trying to make a little lan chat room i tried to add both codes of sender and receiver to the same one using 2 winsock , but the problem was that i added 2 commands to the same button winsock1.connect... and winsock2.localhost... i got an error , i want it to send and received at the same time i got always the same error
use the _Connected event, it gets fired when connected
use the _Error event, it gets fired when its unabled to connect to server
use the _Close event, it gets fired when the server closes the client connection