Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

My program wont let me connect to anything BUT 192.*.*.* IP's or "localhost" it wont let me connect to my 'internet ip'.... Any ideas?? Btw this function below is called simply with Connect("23.236.236.23") and that ip was just.. random. :P

 

The client code:

 

 Private Function Connect(ByVal IP As String)
   On Error GoTo err
   mobjClient = New TcpClient(IP, 15200)
   DisplayText("Connected to host" & vbCrLf)

   mobjClient.GetStream.BeginRead(marData, 0, 1024, AddressOf DoRead, Nothing)

   Send("New client online")
   Connect = 1
   Exit Function

err:
   Connect = 0
 End Function

 

The server code:

 

 Private Sub DoListen()
   Try
     mobjListener = New TcpListener(15200)
     mobjListener.Start()
     Do
       'Dim x As New Client(mobjListener.AcceptSocket)
       Dim x As New Client(mobjListener.AcceptTcpClient)
       AddHandler x.Connected, AddressOf OnConnected
       AddHandler x.Disconnected, AddressOf OnDisconnected
       'AddHandler x.CharsReceived, AddressOf OnCharsReceived
       AddHandler x.LineReceived, AddressOf OnLineReceived
       mcolClients.Add(x.ID, x)
       Dim params() As Object = {"New connection"}
       Me.Invoke(New StatusInvoker(AddressOf Me.UpdateStatus), params)
     Loop Until False
   Catch
   End Try
 End Sub

 

Everything works.. apart from connecting outside my local network. That is connecting to other peoples computers running the server.... Yes they all have the .net framework and such.

Edited by Chrisz

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...