Search Results

Search found 2 results on 1 pages for 'thehockeygeek'.

Page 1/1 | 1 

  • IP Address Lookup in VB.net (XP vs Windows 7)

    - by TheHockeyGeek
    Currently I use the following code to retrieve the IP address of the local workstation... strIPAddress = System.Net.Dns.GetHostEntry(strComputerName).AddressList(0).ToString() This is fine for the Windows XP workstations. However, in Vista and Windows 7, this returns the IPv6 address which is not used at all. Is there a method of setting this to work so it always returns the IPv4 address regardless of platform? I know I can increment the AddressList value to 1 and get the correct IP in Windows 7. The bad part is that this requires going through the motions of identifying the OS and choosing one or the other. The must be some way of specifying IPv4 only. Perhaps getting a result from DNS on the network rather than the workstation itself?

    Read the article

  • Async Socket Listener on separate thread - VB.net

    - by TheHockeyGeek
    I am trying to use the code from Microsoft for an Async Socket connection. It appears the listener runs in the main thread locking the GUI. I am new at both socket connections and multi-threading all at the same time. Having a hard time getting my mind wrapped around this all at once. The code used is at http://msdn.microsoft.com/en-us/library/fx6588te.aspx Using this example, how can I move the listener to its own thread? Public Shared Sub Main() ' Data buffer for incoming data. Dim bytes() As Byte = New [Byte](1023) {} ' Establish the local endpoint for the socket. Dim ipHostInfo As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName()) Dim ipAddress As IPAddress = ipHostInfo.AddressList(1) Dim localEndPoint As New IPEndPoint(ipAddress, 11000) ' Create a TCP/IP socket. Dim listener As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) ' Bind the socket to the local endpoint and listen for incoming connections. listener.Bind(localEndPoint) listener.Listen(100)

    Read the article

1