|
-
Aug 3rd, 2005, 05:30 AM
#1
Thread Starter
Hyperactive Member
How to send and receive message in single form and with two winsock Controls
Dear friends
I want to develope a single form which can perform as local and remote host simultaneously, is it possible if yes then please tell me how. Basically what i am doing, that i set winsock.localport = 15151 and winsock.listen on form load event.
when any user want to send message to any other user i wrote these code
if user = 'aa' then
winsock.remotehost = "192.168.0.2"
if user = "bb" then
winsock.remotehost = "192.168.0.3"
endif
winsock.remoteport = 15151
winsock.connect
it is not working , where i am mistaking
Last edited by zubairkhan; Aug 3rd, 2005 at 05:52 AM.
-
Aug 3rd, 2005, 10:02 AM
#2
Member
Re: How to send and receive message in single form and with two winsock Controls
I don't know why it doesn't work, because I haven't seen your code, but this works :
Add 2 command buttons and 2 winsock controls to a form and paste the following code :
VB Code:
Private Sub Command1_Click()
Winsock2.Connect "192.168.0.2", 11151 '' local IP address
End Sub
Private Sub Command2_Click()
Winsock2.Close
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 1151
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock2_Connect()
MsgBox "Success"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|