Listen Remote Computer Port - c#

I want to have a console application (C#) which listens a socket port on a remote computer. I want to run that application on my computer and want it to listen a port on a remote computer, i have IP, Port, User, Password information of that remote computer. Can i do that ?
I know how to listen a port on the local computer, i have a console application (acts as server) that keeps listening my computer's port (like port 8001) and whenever there is a request, it detects it, fulfill the requirement and send response to the client. I want the same thing but want to put the listener on some other computer.
Please tell me is it possible to listen remote computer's port, if yes please provide a direction.
Thank you.

Can i do that ?
No, you will have to install and run the application on the remote computer. Since you already have administrative privileges on that computer that wouldn't be too much of a problem for you.

Related

Windows Service to continuously monitor network server on TCP port

This is my first foray into socket programming. I need some help to get started. Basically, I have a server that sends out status updates on a specific TCP port. I need a client computer to look out for those update messages. I've decided to create a Windows Service in C# that will be installed on the client computer. I can't figure out if the service should be TCP listener (server) or client. Any guidance will be highly appreciated.
Since you already have a server that will send the updates, all you need to do to receive these updates is to create a TCP client on your host. This will serve as the listener, just connect it to the appropriate server's IP and port. Alternatively if you already have a client that connects to the server and just want to intercept the traffic, use something like tcpdump.
Figured it out. This comment from TcpClient Class threw me off:
// Note, for this client to work you need to have a TcpServer
// connected to the same address as specified by the server, port
// combination.

c# Socket.RemoteEndPoint shows different port that I'm using to connect

I've developed a basic console application that will work as server-client. My general workflow will be like, Server starts clients connect to server and once a client send something the server will receive it and send it to ALL clients. Currently I can do this with my codes but my question is when I send back I've tested Socket.RemoteEndPoint and I saw ports like 65xxx. Like my first client had 65020, second 65021 and so go on. I wonder why this happen since I connect with using 9001 port and listen to 9001 port on my computer. I've done a little bit research but couldn't find a solution to my question. Why do I get these port numbers when I use Socket.RemoteEndPoint? It's okay for me since I don't use firewall or anything while I'm testing to even if the clients connects from another ports it's fine by me as long as its works but what if I have a firewall and I open ONLY 9001 port? Will my client-server based programs work then?
So far as the server/firewall on that machine is concerned, what normally matters is the server port. You wouldn't normally apply any filtering based on the client's port, which as I said in a comment, will normally be an ephemeral port. Under most circumstances, client code will make no effort to specify the local port or IP address and will let the OS pick appropriate values.
The Socket class's LocalEndPoint and RemoteEndPoint use "local" and "remote" to mean "from the perspective of the machine on which this code is running", not "who initiated the connection vs who was connected to".
So on the server, LocalEndPoint will give you information about the server end of the connection and RemoteEndPoint will give you information about the client end of the connection. Irrespective of who initiated the connection.

Serial Port Over Remote Desktop

need your help.
I have this scenario:
I have to comunicate to a Printer connected to Serial Port, over remote Desktop, in bidirectional communication, it means, i want to send comands to the Serial Port, and get the response of the remote printer, all of this in Remote Desktop.
I successfull can connect locally, i can send commands to the printer in the remote Desktop with a Spooler, but locally i can get the response that the Printer sends me when all finish (close Fiscal Document).
I have tried with c#, but this only works when i the Printer is connected in my local machine.
I am sharing ports, printers in my remote desktop communication, but i cannot get any response from the remote Printer.
How can i do that?
Any help, will be appreciated.
Normally I will send some code, but, i just want some help of you telling me if that is possible, or maybe if you have some examples or guides.
Regards
Firewall is blocking communications.

How to open Ports through C#?

I'm kind of a beginner at programming, so I don't know what I'm about to ask is even possible. I want to make a TCP/IP connection to a server over WAN.
Both Client and Server programs were made by me they work just fine in a LAN. I'm now trying over a WAN. I know the server IP Address and the Port he's listening from, but as a client I can't make the connection. I supposed it's because the Port is not actually open/available.
How can I make this to happen in the server side? Is there a way for me to start the server (maybe as administrator) and for it to open the Port by itself? Is this a router or Firewall issue?
If I wasn't clear enough, feel free to ask.
Cheers.
PS: Let me put it this way:
If I make the connection in a LAN, it works. I set it to the local IP Address (192.168....) and choose whatever port I want and it works just fine. Once I put my public IP provided my ISP, it doesn't. I set the firewall router to accept everything and put a new rule in windows firewall to open port 100. What changed?
Please check the following list,
Server Firewall rules to exclude the desired port
Router Firewall to exclude the desired port
Check any installed security software blocking your desired port
Last and crucial! Open router interface and configure your NAT settings so the packets running via the desired port are served to your local server IP
If everyhting is fine and your ISP is not blocking the desired port then you will have no problem.
You can also visit canyouseeme.org in order to check that server listening alright!
Kind Regards,
KB

listen for data on tcp/Ip port which is used by another application C#

I am using HyperEngine which is streaming data on ip 127.0.0.1 and port 8778.
I want to continuously listen on this ip and port. I can't figure out how should I write port listener for this scenario.
Please check whether the below suggestion works for you.
Stop the HeyperEngine service or application.
Create a new application which listens to port 8778 on your local
system.
This new application should process the steam data on port 8778
(the way you want to process) and also publish it to another port.
Change the port number of your HyperEngine to the port in which
you published the steam from your new application.
Start the HeyperEngine service or application.
Note: this solution will work, if you have option to change the HyperEngine port configuration.

Categories

Resources