TCP port without network adapter - sockets

I am intending to write some software modules that will all run on a single machine, and I would like for them to communicate with each other via TCP.
It is likely that the machine I am using will not have a physical network adapter. Will TCP connections to localhost be able to work correctly if there is no physical network adapter?
The operating system that I am running on is Linux for Tegra.
Thanks.

Related

How to create a virtual network interface on a remote machine bridge to an interface on a local machine?

I have a local Linux machine (L), with a network interface (eth0) connected to (currently) only one device (D).
L/eth0 only has an ipv6 link local address.
D also only has an ipv6 link local address.
Client software on L discovers D's link local address by sending a custom multicast packet over eth0. The response contain the device link local address as well as some configuration information. From there it communicates with the device using various UDP or TCP port.
My goal is to be able to use the device from a remote machine (R). The remote machine being most likely a Linux docker container running on some host - although it could be a native macOS or other.
That means running both the discovery protocol and communicate with the device. I definitely cannot modify software on the device, and cannot modify most of the client software running on the local Linux or remote machine (Limited modification could possibly be requested)
My idea was to somehow create a virtual interface on the remote machine, that would remotely be bridged to the the local machine, so that the multicast discovery works from the remote, and so that I can just connect to D link local address from the remote.
I'm not sure which tool(s) I should be using.
I'm googling various things about VPN and tunnel, TUN/TAP interfaces, bridges, VETH, VLAN, etc... but I'm having trouble connecting the dots here... I have no budget for this, so I'm looking for open source tools, or just something I can cobble up together with common tools.
Thanks

TCP Server on Computer. No connection established

I have 2 devices on the same network and I want to communicate via TCP on the same network. Device 1 is a computer running a Debian OS on virtualbox, and another is an android tablet. Interesting enough, my tablet acts as a server no problem via an app. Any other device on the same network can connect to the tablet. The computer on the other hand is not so cooperative. Running netcat -l -p 6667 on my computer should allow incoming connections to communicate with my computer via TCP on port 6667, but this is not the case. Netcat opens a socket but I can't connect to it in anyway. Is there an underlying reason as to why this does not work? All device are under the same router. I have disabled firewall on my computer as well.
From your information, i would say your problem is you need to set up port forward.
VirtualBox and VMware both create virtual machines with the NAT network type by default. If you want to run server software inside a virtual machine, you’ll need to change its network type or forward ports through the virtual NAT.
here is a guide that will show you how to Forward ports to virtual machine

Sniffing data on uClinux local loopback

I am looking for a way to monitor/sniff local loopback traffic inside a uClinux embedded device. I have several processes that communicate via the local loopback and want to capture this traffic on an outside machine. So I want to direct a copy of all local loopback traffic out the "real" Ethernet to a specific IP address, namely that of my Windows PC running a sniffer.
Is this possible, maybe with iptables or something? The traffic is all UDP, between a few dozen ports. If not, I was thinking about writing some code to open a raw socket, read in the packets in question and forward them to my fixed IP address. Would it work to capture local loopback traffic with a raw socket?

How to capture packets in localhost between two ports

I have two applications communicating on same machine (localhost) using socket. If application are on different machine I can use Wireshark. But how to capture packets on same machine.
I do not know on which port number application are communicating. Because I am using library calls and do not know lower level details.
We are having our application on Ubuntu and Windows XP.
On Linux you can use netstat to determine the ports that your application are using. Then you can use Wireshark to capture on the loopback interface (just enter your own IP address if 127.0.0.1 dont work).
Refer to: https://stackoverflow.com/questions/1566234/ for capturing on Windows.

How does communication occur in java through TCP sockets on the same machine

I have two servers, written in Java, that communicate through sockets and TCP. The servers are both on the same Linux machine. If the servers were on different machines then data would have to go through network adapters and network cables, but since the servers are on the same machine how does the OS actually move data efficiently form one server to the other.
Generally, the messages will be sent over the loopback interface:
In TCP/IP a loopback device is a virtual network interface implemented in software only and not connected to any hardware, but which is fully integrated into the computer system's internal network infrastructure. Any traffic that a computer program sends to the loopback interface is immediately received on the same interface.
However, you can manage to configure your situation so that, for example, the server is referred to via an external IP address so that messages actually go out over the network before being routed back to the same machine.
If two programs are using TCP/IP to communicate on the same machine, they are probably connected through the loopback interface