c# - TCP Echo on different adapter -


i'm trying write program computer 2 network adapters (private , public) echoes data received on private public , vice versa. need listen on 2 specific ports, , more specifically, should open socket server on private , socket client on public.

the computer's ip address on public 192.168.1.21 , ip address on private 172.16.13.1, thought work:

ipendpoint privateendpoint1 = new ipendpoint(ipaddress.parse("172.16.13.1"), port1); ipendpoint privateendpoint2 = new ipendpoint(ipaddress.parse("172.16.13.1"), port2); ipendpoint publicendpoint1 = new ipendpoint(ipaddress.parse("192.168.1.21"), port1); ipendpoint publicendpoint2 = new ipendpoint(ipaddress.parse("192.168.1.21"), port2);  tcplistener prilist1 = new tcplistener(privateendpoint1); tcplistener prilist2 = new tcplistener(privateendpoint2);  tcpclient pubcli1 = new tcpclient(publicendpoint1); //error here tcpclient pubcli2 = new tcpclient(publicendpoint2); 

i streams , actual echoing.

the problem error on line marked:

only 1 usage of each socket address (protocol/network address/port) permitted

it seems error ipendpoint constructor not differentiating between 2 ip addresses , 2 network adapters. i've looked using normal sockets instead of tcpclients, didn't seem change anything.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -