SERVER/CLIENT EXAMPLE |
TCPClient (NOT THE CLASS) call name is TCPReadWrite.vb |
Public Class TCPClient Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load TxtIp.Text = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).AddressList(1).ToString
|
CLIENT SEND DATA TO SERVER |
Imports System Public Class FrmClient Inherits System.Windows.Forms.Form
'Receive Packs from Any IP only from Port TxtPort.text
Private Sub FrmClient_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
Handles MyBase.Closing x = False Try Private Sub FrmClient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try |
SERVER RECEIVE DATA FROM CLIENT |
Imports System Imports System.Net Imports System.Net.Sockets Imports System.Threading Imports System.Text Public Class FrmServer **HERE IS WINDOWS DISGNER GENERATED CODE** Private Sub StartListening() ''''TxtPort.Text=11000 Dim x As Boolean = True receivingUdpClient = New UdpClient(TxtPort.Text) Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Parse("212.190.182.240"),
CType(TxtPort.Text, Integer)) ' Blocks until a message returns on this socket from a remote host. lblUdpCount.Text = lblUdpCount.Text + 1 TxtInfo.AppendText("**" + returnData.ToString() + "**" +
nl) End Sub End class
|
ok