VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Sends messages to a remote host ip and a port on that ip.. also waits for data incoming!

by SplamoniMan (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 5th February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Sends messages to a remote host ip and a port on that ip.. also waits for data incoming!

API Declarations


you can download this program at:
www.splamoni.iwarp.com
but if you are going to use this code please email me:
[email protected]
[email protected]
[email protected]
thanx..

'BY ADAM K DEAN
'WWW.SPLAMONI.IWARP.COM
'Create a winsock control name it to sckMain and change the protocol to UDP protocol
'Create 5 textboxes name them in order: txtRHost, txtRPort, txtLPort, txtOut, txtIn in txtOut set the Locked property to True
'Create 2 commandbuttons name them in order: cmdSend, cmdConnect



Rate Sends messages to a remote host ip and a port on that ip.. also waits for data incoming!



sckMain.RemoteHost = txtRHost 'In this textbox it shall eigther be an IP address or a freindly computer name i.e. PC1 to the computer you´re about to connect to.
sckMain.RemotePort = txtRPort 'Here shall a remote port be filled in thats the port to the computer you´re about to connect to
sckMain.Bind txtLPort 'The port you are using, the other user uses this port for remote port
cmdConnect.Enabled = False
txtRHost.Enabled = False
txtRPort.Enabled = False
txtLPort.Enabled = False
Me.Caption = "Done..!"
End Sub

Private Sub cmdSend_click()
On Error Resume Next
'Send the data thats in txtIn to the other user if it´s not empty
If txtIn <> "" Then
sckMain.SendData txtIn.Text
End If
Me.Caption = "Data sent.."
txtIn.Text = ""
End Sub

Private Sub Form_Load()
lblIP.Caption = "Your IP: " & sckMain.LocalIP
End Sub

Private Sub sckMain_Dataarrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim tx$
'Shows the message from the other user in txtOut and makes a beep sound so the other user knows that he/she got a message
Me.Caption = "Data In.."
sckMain.GetData tx$
txtOut.Text = tx$
Beep
Me.Caption = "Data Got.."
End Sub

Download this snippet    Add to My Saved Code

Sends messages to a remote host ip and a port on that ip.. also waits for data incoming! Comments

No comments have been posted about Sends messages to a remote host ip and a port on that ip.. also waits for data incoming!. Why not be the first to post a comment about Sends messages to a remote host ip and a port on that ip.. also waits for data incoming!.

Post your comment

Subject:
Message:
0/1000 characters