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.
Related
I am having an static IP (amazon ec2 instance) and a defined port which is connected to a device. This device send data on this particular port usually every minute over the GSM network.
For eg.172.20.1.170 is the IP and 4001 is port.
I am using C# socket to read the data but it is giving error "No connection could be made because the target machine actively refused it 172.20.1.170:4001"
Please suggest the sample code to read the data from the IP and port
Try to hit the ip and port embedded in ur device from the web browser (chrome , firefox).. make sure our PC and device are in same network... if you get the data on browser you are good to go for coding..
you can also try hyper terminal ..
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.
I develop a application remote desktop on c#. it' work good on ADSL with router add NAT port.
but when i run on computer connect internet use usb modem 3g sim because usb modem not use connect like a ADLS (router), application not work. how i can connect pc use usb model? thanks
If your 3G phone service provider puts you behind NAT then you're short of luck as the NAT prevents any incoming connections to reach your computer.
A workaround is to set up a VPN connection from your 3G-connected computer and set up port-forwarding at the VPN server-side, that way your computer can receive new connections, but they would be tunneled.
I have a device connected to a host computer through cradle usb. Now, I'm just wondering if I could use C# sockets to communicate with the device (ie device sending data, host computer processing it then replying back to the device). How can I accomplish this? by that, what ip address etc etc.. do I have to change so that it would connect cause I have the sockets working on wireless. If not, then is there a way to connect to the device, open and read a file (a text document to be more specific) from the device to my host application.. any ideas?
Thanks! :)
Depending on your target device, when you connect via ActiveSync it likely makes a local RNDIS network connection between teh two devices. You can resolve "ppp_peer" as the partner's network name instead of trying to use a hard-coded IP address (IIRC the IP is different on XP than on Vista).
Be aware that it's not a full connection. TCP packets gets passed through, but things like ICMP do not.
Of course, this just gives you a socket connection, just like if you were to connect between two PCs. It's not going to allow you to do file system operations unless you have an app on the other side listening for commands. If you want that type of thing, Microsoft provides the Remote API (RAPI) interface (wrapped in managed code here)for a lot of basic commands, and it can be extended (with C) to do anything you'd like.
I found an article on getting active tcp/udp connections on a machine.
http://www.codeproject.com/KB/IP/iphlpapi.aspx
My issue however is I need to be able to determine active connections remotely - to see if a particular port is running or listening without tampering with the machine.
Is this possible?
Doesn't seem like it natively, otherwise it could pose a security issue. The alternative would be to query a remoting service which could then make the necessary calls on the local machine.
Any thoughts?
Nmap is what you are looking for.
There is no way to know which ports are open without the remote computer knowing it. But you can determine the information without the program running on the port knowing it (i.e. without interfering with the program).
Use SYN scanning:
To establish a connection, TCP uses a three-way handshake. This can be exploited to find out if a port is open or not without the program knowing.
The handshake works as follows:
The client performs an active open by sending a SYN to the server.
The server replies with a SYN-ACK.
Normally, the client sends an ACK back to the server. But this step is skipped.
SYN scan is the most popular form of
TCP scanning. Rather than use the
operating system's network functions,
the port scanner generates raw IP
packets itself, and monitors for
responses. This scan type is also
known as "half-open scanning", because
it never actually opens a full TCP
connection. The port scanner generates
a SYN packet. If the target port is
open, it will respond with a SYN-ACK
packet. The scanner host responds with
a RST packet, closing the connection
before the handshake is completed.
The use of raw networking has several
advantages, giving the scanner full
control of the packets sent and the
timeout for responses, and allowing
detailed reporting of the responses.
There is debate over which scan is
less intrusive on the target host. SYN
scan has the advantage that the
individual services never actually
receive a connection while some
services can be crashed with a connect
scan. However, the RST during the
handshake can cause problems for some
network stacks, particularly simple
devices like printers. There are no
conclusive arguments either way.
Source Wikipedia
As is mentioned below, I think nmap can do SYN scanning.
Using sockets for TCP port scanning:
One way to determine which ports are open is to open a socket to that port. Or to a different port which finds out the information for you like you mentioned.
For example from command prompt or a terminal:
telnet google.com 80
UDP Port scanning:
if a UDP packet is sent to a port that is not open, the system will respond with an ICMP port unreachable message. You can use this method to determine if a port is open or close. But the receiving program will know.
neouser99 (et al) has suggested NMAP. NMAP is very good if all you're trying to do is to detect ports that are open on the remote machine.
But from the sounds of your question you're actually trying to determine what ports are both open and connected on your remote machine. If you're after a general monitoring solution, including the connected ports, then you could install an snmp server on your remote machine. There are two MIBs that let you check for port status which are TCP-MIB::tcpConnectionTable and UDP-MIB::udpEndpointTable.
The daemon (server) supplied in net-snmp has most likely got support for these mibs.