TCP port proving
Author
Discussion

julian64

Original Poster:

14,325 posts

286 months

Wednesday 14th February 2018
quotequote all
sitting at work trying to get two computers to talk through a TCP port but finding great difficulty wondering why they are seeming blocked

So I turned to what I thought was a simple TCP program called

https://packetsender.com/

looks simple. Set one up on one computer and another instance on the second computer. Set the port to 3333 on both and alter windows firewall to allow incoming and outgoing port 3333. Both computers can ping each other on the internal network

However connection cannot be established and I think this program is sending for a TCP service with an everchanging TCP port at the bottom right of the screen when I want it to both send and receive on 3333

Obviously I'm being stupid here. The hub isn't interfering so why can't I get this program to demonstrate communication over 3333.


numpty alert.

buggalugs

9,301 posts

269 months

Wednesday 14th February 2018
quotequote all
Netstat -aln to make sure it’s really listening on that port

I usually use telnet to try the connection

If it’s listening but won’t connect it’s firewall

TonyRPH

13,560 posts

200 months

Wednesday 14th February 2018
quotequote all
I setup both ends on port 6666.

When I started it, Windows firewall requested permission to allow it through which I granted.

I disabled the UDP server and SSL server.

This is what I get:


buggalugs

9,301 posts

269 months

Wednesday 14th February 2018
quotequote all
Some of hose have a source port of 6666, source port is not usually important it’s destination port 6666 you want.

Check that they’re listening on TCP with netstat and if they are see if turning firewalls off helps.

julian64

Original Poster:

14,325 posts

286 months

Wednesday 14th February 2018
quotequote all
Its the source and destination that needs to be open on the windows firewall though isn't it. In that scenario he needs to open for outgoing and incoming 6666, but doesn't the source port also need opening?

Sorry just came back from installing telnet on both computers and messing about

toastyhamster

1,802 posts

128 months

Wednesday 14th February 2018
quotequote all
Wireshark and telnet covers a lot of scenarios. Could be the Firewall or check if you have any intrusion protection on over and above Windows Firewall.

julian64

Original Poster:

14,325 posts

286 months

Wednesday 14th February 2018
quotequote all
I thought I could make the packet sender send and receive on 3333. The packet sender program is using random posts above 60K to send on. I don't quite understand why the packet sender program doesn't allow me to send and receive through a named single port

When programming in c# allows me to set up a listening port on a specific port and to send through a specific port.

In the packet send program above which is meant to be freeware to diagnose ports, it then adds the complication of having a TCP server on a random port above 60K. which of course might also be blocked by windows firewall

Obviously I'm not quite grasping this.

julian64

Original Poster:

14,325 posts

286 months

Wednesday 14th February 2018
quotequote all
netstat doesn't help me as I currently don't have anything listening on the 3333 port so it doesn't see it, I only want to check its free to use and not blocked. I can't seem to make packet sender listen on anything other than its TCP server 60K ports.

I'm just looking into the telnet server to see if I can make it listen on a certain port

droopsnoot

14,822 posts

274 months

Wednesday 14th February 2018
quotequote all
I was always under the impression that the outgoing port is irrelevant, it's the destination port that matters. I haven't done any sockets for a while, but last time I did I don't think there was a way to specify what outgoing port was used, only the port I was trying to reach. So if I set up a listener on 3333, I just open incoming TCP connections to that port on the firewall and all goes OK. I had more success with opening by port rather than by application, but again a while back so not sure if Windows later than 7 work differently.

TonyRPH

13,560 posts

200 months

Wednesday 14th February 2018
quotequote all
droopsnoot said:
I was always under the impression that the outgoing port is irrelevant<snip>
This is correct, unless there is some kind of port translation or weird firewall in place.

See Ephemeral port on Wikipedia for an explanation.

I posted a screenshot of my test using the same software as the OP and I didn't have to do anything special.

I was hoping the OP would post a screenshot of his setup so that we could possibly gain an idea of what he is doing.

OP, download TCPView as it also shows the process all in a nice GUI.

Like this... The "Local port" entry shows which port it's listening on.

If you're in a corporate environment, it may well be possible that a group policy *or* anti virus program is preventing the app from creating a listening socket.


eltawater

3,563 posts

211 months

Wednesday 14th February 2018
quotequote all
julian64 said:
netstat doesn't help me as I currently don't have anything listening on the 3333 port so it doesn't see it, I only want to check its free to use and not blocked. I can't seem to make packet sender listen on anything other than its TCP server 60K ports.

I'm just looking into the telnet server to see if I can make it listen on a certain port
You need to look at this in a different way. Packet Sender can act as a both a sender and receiver, but you need to think of local machine A and remote machine B.

Remote Machine B listens on port 3333
You want to check that Local Machine A can connect to Remote Machine B where it's listening on port 3333. It doesn't matter that Local Machine A is trying to send out on a high numbered port, your firewall should be set to only worry about where the destination listening port is.

So setup Packet Sender on Remote Machine B to Enable TCP Server on port 3333



Start Packet Sender on Local Machine A and give it the IP address of Remote Machine B, Port 3333, a name for this request and some ASCII text to send. Click the send button to test the connection.



Now look at Packet Sender running on Remote Machine B and you should see the incoming request appear in the table at the bottom.

Being able to ping a destination host means very little.
What is the ip address of your Local Machine A and your Remote Machine B? This will help to provide a clearer illustration to you.

buggalugs

9,301 posts

269 months

Thursday 15th February 2018
quotequote all
julian64 said:
netstat doesn't help me as I currently don't have anything listening on the 3333 port so it doesn't see it, I only want to check its free to use and not blocked. I can't seem to make packet sender listen on anything other than its TCP server 60K ports.

I'm just looking into the telnet server to see if I can make it listen on a certain port
Netstat is currently telling you that the port is free to use, when the program that is supposed to listen on 3333 is running it will tell you if it’s lying or not. It will also tell you what interfaces it’s listening on - localhost only or all or something else.

Packet sender - it doesn’t listen it opens an outbound connection. Ignore the source port on the sender.

It’s not telnet server you want it’s the client, it’s a quick and easy way to open a tcp connection to an ip and port you choose. Telnet google.com 443 should give you a black screen then kick you off if you button mash. If it can’t connect it will hang for a bit then say so.

If the port is listening on tcp on the right IP or * not localhost according to netstat, and you still can’t connect to it then turn the firewalls off at both ends and try again. If it works then you know it’s the firewalls you need to mess with.

You can also try connecting from the same box it’s listening on.

HTH

WinstonWolf

72,863 posts

271 months

Thursday 15th February 2018
quotequote all
TonyRPH said:
droopsnoot said:
I was always under the impression that the outgoing port is irrelevant<snip>
This is correct, unless there is some kind of port translation or weird firewall in place.

See Ephemeral port on Wikipedia for an explanation.

I posted a screenshot of my test using the same software as the OP and I didn't have to do anything special.

I was hoping the OP would post a screenshot of his setup so that we could possibly gain an idea of what he is doing.

OP, download TCPView as it also shows the process all in a nice GUI.

Like this... The "Local port" entry shows which port it's listening on.

If you're in a corporate environment, it may well be possible that a group policy *or* anti virus program is preventing the app from creating a listening socket.

yes Generally speaking the outbound port *shouldn't* matter.

https://www.nirsoft.net/utils/cports.html

Is also handy for seeing what's listening on what port.

julian64

Original Poster:

14,325 posts

286 months

Thursday 15th February 2018
quotequote all
eltawater said:
You need to look at this in a different way. Packet Sender can act as a both a sender and receiver, but you need to think of local machine A and remote machine B.

Remote Machine B listens on port 3333
You want to check that Local Machine A can connect to Remote Machine B where it's listening on port 3333. It doesn't matter that Local Machine A is trying to send out on a high numbered port, your firewall should be set to only worry about where the destination listening port is.

So setup Packet Sender on Remote Machine B to Enable TCP Server on port 3333



Start Packet Sender on Local Machine A and give it the IP address of Remote Machine B, Port 3333, a name for this request and some ASCII text to send. Click the send button to test the connection.



Now look at Packet Sender running on Remote Machine B and you should see the incoming request appear in the table at the bottom.

Being able to ping a destination host means very little.
What is the ip address of your Local Machine A and your Remote Machine B? This will help to provide a clearer illustration to you.
Brilliant, works. Not sure where I was tying myself up in knots.

TCPView works a treat to show the dynamic port status although it would be nice to filter to only the ports I want to monitor but nevertheless brill

Cheers guys
computers are connected to a netgear GS734T hub which I thought might have had the capability of blocking port transmission but obviously not.

Anyway thanks again all.





Difficult to explain but you are all about to make a deaf woman very happy.

eltawater

3,563 posts

211 months

Friday 16th February 2018
quotequote all
julian64 said:
Brilliant, works. Not sure where I was tying myself up in knots.

TCPView works a treat to show the dynamic port status although it would be nice to filter to only the ports I want to monitor but nevertheless brill

Cheers guys
computers are connected to a netgear GS734T hub which I thought might have had the capability of blocking port transmission but obviously not.

Anyway thanks again all.





Difficult to explain but you are all about to make a deaf woman very happy.
thumbup

Blown2CV

31,665 posts

235 months

Sunday 18th February 2018
quotequote all
latter day OS and also modern home networks tend to bundle all sorts of security things that could get in the way of this seemingly simple activity.

toastyhamster

1,802 posts

128 months

Sunday 18th February 2018
quotequote all
Quite, if anybody can work out a way my work domain joined laptop (very locked down, no local admin) can print to a home workgroup'd printer let me know (can ping, vnc to local devices, etc).


Blown2CV

31,665 posts

235 months

Sunday 18th February 2018
quotequote all
toastyhamster said:
Quite, if anybody can work out a way my work domain joined laptop (very locked down, no local admin) can print to a home workgroup'd printer let me know (can ping, vnc to local devices, etc).
it could be a domain policy in which case you're fked. It could be lack of admin rights in which case you might be able to convince the CTS sysadmins to sort you out. Or it could be a VPN config parameter (this happened to me) as many VPNs by default, when connected, block access to addresses local within the source network. You may just be able to check a checkbox to make this work (or disconnect from VPN when you want to print).