-
Winsock , Help!!!!
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
-
Re: Winsock , Help!!!!
Edit your post and add VBCODE tags so your code will be much more readable.
-
1 Attachment(s)
Re: Winsock , Help!!!!
You cannot tell winsock to listen on a port then tell the same winsock to connect to itself.
Have a look at the sample project i've done for you, no fancy stuff at all.
-
Re: Winsock , Help!!!!
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 ?
-
1 Attachment(s)
Re: Winsock , Help!!!!
Get the attachment, it's not brilliant code but it does show you how to send files through winsock to give you an idea.
-
Re: Winsock , Help!!!!
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 :cry:
-
1 Attachment(s)
Re: Winsock , Help!!!!
i changed the project , i don't have that error any more , but it's simply not working , here's the file
-
Re: Winsock , Help!!!!
dont use timers
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
-
Re: Winsock , Help!!!!
-
1 Attachment(s)
Re: Winsock , Help!!!!
i found the error , i m connecting to my self and that connection only accept 1 receiver how can i let it accept many? here's the project