Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 452
Viewed: 2835
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

sending messages to another computer over network.

As i said before... three textboxes, two command buttons and a winsock control.
Text1 is for the IP address so it doesn't have to be very long, Command1 is to connect with, so put it next to Text1.
Then Text2 is the main box that shows what has been said so it must be quite big.Then obviously Text3 is for what is going to be sent and the command button is used to send the message.

I think that's it, now all you need is two computers


I forgot two things, 1) Make sure the winsock protocol is set to TCP\IP.
2) incase you didn't know, You must type the IPAddress of the computer you want to send the msgs to in text1 then press connect

also command1.caption=Connect and command2.caption=send

hope it works

Highlight all by clicking in box
<!---Declaration--->
none

Highlight All
<!---Code--->
Private Sub form_load() 
Text2.multiline=True
winsock1.localport=85
Winsock1.listen

End Sub

Private Sub Command1_Click()
Winsock1.connect (Text1.Text, "85")
Command1.enabled=False 'just so you don't try to connect again, which result in an error.

End Sub

Private Sub Text2_GotFocus()
Text1.SetFocus 'so u can't edit what being said

End Sub

Private Sub Winsock_ConnectionRequest(requestID As umm?)
Winsock1.accept(requestID)

Private Sub Winsock_DataArrival()
Dim strData ' a variable to hold the incoming msg
winsock1.getdata strdata
Text2.seltext=strdata & vbCrLf 'The vbCrlf just puts the msg on a new line.

End Sub

Command2_click()
winsock1.send (Text3.Text) 'I'm not sure if it's Send or SendData, but don't worry there's only one so just put it there.
Text2.seltext=Text3.Text & vbCrLf
End Sub

form_unload event()
Winsock1.close;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions