hi everyone :
please how to change the destination address from "localhost" to the ip: "192.168.1. 1"
and how to send broadcast packet.
please how to change the destination address from "localhost" to the ip: "192.168.1. 1"
Code:
Static port_server As Integer = 5000 Static name_server As String = "localhost" Static port_client As Integer = 5001 Dim sock_server As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp) sock_server.EnableBroadcast = True Dim serverEP As IPEndPoint = New IPEndPoint(Dns.GetHostEntry(name_server).AddressList(0), port_server) Dim clientEP As IPEndPoint = New IPEndPoint(Dns.GetHostEntry(name_server).AddressList(0), port_client) Dim enter_string As String = "hello" Dim send_byte() As Byte send_byte = System.Text.Encoding.ASCII.GetBytes(enter_string) sock_server.Bind(clientEP) sock_server.SendTo(send_byte, SocketFlags.None, serverEP)
Comment