BleepingComputer.com: P2P Only works on my network?

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

P2P Only works on my network? How do i extend the reach?

#1 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 01:26 PM

Hi, i have followed a tutorial to make a simple P2P messenger program, here is my code:

Imports System.Net.Sockets
Imports System.Threading
Imports System.IO

Public Class Form1
	Dim Listener As New TcpListener(65535)
	Dim Client As New TcpClient
	Dim Message As String = ""

	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim ListThread As New Thread(New ThreadStart(AddressOf Listening)) 'Creates the thread
		ListThread.Start() 'Starts the thread
	End Sub

	Private Sub Listening()
		Listener.Start()
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		If Listener.Pending = True Then
			Message = ""
			Client = Listener.AcceptTcpClient()

			Dim Reader As New StreamReader(Client.GetStream())
			While Reader.Peek > -1
				Message = Message + Convert.ToChar(Reader.Read()).ToString
			End While

			MsgBox(Message, MsgBoxStyle.OkOnly)
		End If
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Client = New TcpClient("192.168.1.65", 65535)

		Dim Writer As New StreamWriter(Client.GetStream())
		Writer.Write(TextBox1.Text)
		Writer.Flush()
	End Sub

	Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
		Listener.Stop()
	End Sub
End Class


It works if i run it on my computer, it sends to myself but not to my freind, anyone got any ideas?

Thanks alot, Wolfy87.

#2 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 01:54 PM

It also works from my dad to me by the way.

Thanks, Wolfy87.

#3 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 14 April 2009 - 02:17 PM


#4 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 02:23 PM

I've thought of that, diabled BOTH, still nothing, its still being "activly blocked" from the other end

Wolfy87.

#5 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 14 April 2009 - 02:24 PM

Does the person on the other end have a wireless router? Are there multiple computers shared at that location?

Billy3

#6 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 02:26 PM

Yes, thats just it, we are all thru the same router, that is why it works, with my freind in another town it fails but here it works, im not really worried about it not working with my dads, its just getting it to send over the web and not just a wireless network.

Wolfy87.

#7 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 02:28 PM

Is there some form of different ip i need like a web one, longer and more unique?

#8 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 14 April 2009 - 02:31 PM

You would need to forward the connection inside the router. The NAT (Network Address Translation) which the wireless router employs to share the connection among multiple computers means that you can't have something that directly connects to a computer from outside. Basicallly... when the incoming packet arrives, the router doesn't know to which machine the packet belongs, because no machine has asked for a packet.

More info on NAT here:
http://en.wikipedia.org/wiki/Network_address_translation

This is why commercial services such as Aol Instant Messager and Windows Live rely on external tunneling servers with unique IP addresses. Without a machine running outside of a NAT to perform tunneling, that type of system doesn't work.

Billy3

#9 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 14 April 2009 - 03:02 PM

Well how dose FTP fair to this method? What if I had a file on a server and used that as sort of a chat server because my freind has just got that sorted, I know this becuse I as alarmed to find a picture of an orange on my server called from Ashley, would this be a working but slow altitnative?

Thanks, Wolfy87.

#10 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 14 April 2009 - 03:15 PM

FTP requires open ports as well. If he/she was running an FTP server, then the router in question was already configured to allow forwarding.

Billy3

#11 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 15 April 2009 - 05:52 AM

So no matter what ftp should work, aslong as i have a port open? although apparently it is verry slow.

#12 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 15 April 2009 - 01:15 PM

If you're going to do all that work you might as well open the port for your chat app directly.

Billy3

#13 User is offline   Wolfy87 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 414
  • Joined: 25-July 08
  • Gender:Male
  • Location:England

Posted 15 April 2009 - 02:56 PM

but we do, there is a port open?... i think

#14 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 15 April 2009 - 07:44 PM


#15 User is offline   mckooter 

  • Forum Regular
  • PipPipPip
  • Find Topics
  • Group: Members
  • Posts: 211
  • Joined: 29-May 08
  • Gender:Male
  • Location:Maine

Posted 17 April 2009 - 02:46 PM

Yeah Wolfy87

you would need to login to both of your routers admin panel and make sure to open the port, from the looks of it you are using port 65535, so you will need to login and goto port forwarding, and forward that port in the router to your specific internal ip address.

http://portforward.com/ will help you open ports on your specific model of router if your not positive, it has pages specific to different programs/games, but is a good indication of what you should be doing
You can just call me Chris

Pandy said:

I found out I was Marilyn Monroe in a previous life

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users