network sockets

network sockets

Post by Guido » Wed, 12 Mar 2003 20:51:33



Hi,

i have a small socket or linux problem: Can anybody tell me how to develope
a socket application reading IP messages which are not directed to my pc
(have an other IP adress)? I wrote a socket application, but it couldn't
access IP-messages directed to other pcs in the network.

thanks,

Guido

background:

i want to program a "router", which sends IP-Messages through a small bus.
Now i have a character device driver for this bus system and 2 linux
systems connected with this network. Due to the complexity of kernel
development I don't want to write a new linux network driver. so i decided
to develope an application which has a thread for listening to a
TCP/IP-socket from an ethernet card in the first PC and another thread for
reading messages from the bus simultanously.

pc1: 192.168.1.1     <----->    pc2: 192.168.1.2
  ethernet card         IP        no ethernet card
  my application     <----->      my application
        |              BUS              |
simple socket client            simple socket server

1.) the client trys to connect to the pc2, which is not in the ethernet
network.
2.) my application notices this request...
3.) ... and sends it through the bus (with the character device driver
functions)
4.) the application on the other side sends the message to the
IP-network(maybe to the loopback device) and this way directly to the
socket server.
5.) steps 1-4 in the other direction. pc2- pc1

 
 
 

network sockets

Post by Guido » Wed, 12 Mar 2003 21:00:23


Sorry,

hab zu sp?t gemerkt, dass das hier ja eine deutsches Newsgroup ist...
Also: ich habe zwei Linux Rechner, die miteinander ber ein weiteres
Bussystem (schmale bandbreite) verbunden sind. Die beiden Rechner sollen im
gleichen lokalen Netzwerk sein.

Jetzt soll eine Applikation auf dem ersten Rechner (mit ethernet-karte) die
an den zweiten Rechner addressierten IP-Daten abfangen, ber einen
Character Device Treiber an diesen senden. Dort sollen die Daten wieder
zusammengefgt werden und an die IP-Schicht (evtl. per loopback)
weitergegeben werden.

Nun muss die Anwendung ber ein Socket IP-Messages lesen, die an den anderen
Rechner gerichtet sind und folglich eine andere IP-Adresse haben. bisher
habe ich aber nur Sockets programmieren k?nnen, die Nachrichten (RAW), an
den eigenen Rechner addressiert, lesen konnten. Muss ich dafr einige
Parameter im Programm anders einstellen, oder muss ich Linux anders
konfigurieren?

w?re sch?n, wenn mir jemand einen Tipp geben k?nnte,

danke,

Guido


> Hi,

> i have a small socket or linux problem: Can anybody tell me how to
> develope a socket application reading IP messages which are not directed
> to my pc (have an other IP adress)? I wrote a socket application, but it
> couldn't access IP-messages directed to other pcs in the network.

> thanks,

> Guido

> background:

> i want to program a "router", which sends IP-Messages through a small bus.
> Now i have a character device driver for this bus system and 2 linux
> systems connected with this network. Due to the complexity of kernel
> development I don't want to write a new linux network driver. so i decided
> to develope an application which has a thread for listening to a
> TCP/IP-socket from an ethernet card in the first PC and another thread for
> reading messages from the bus simultanously.

> pc1: 192.168.1.1     <----->    pc2: 192.168.1.2
>   ethernet card         IP        no ethernet card
>   my application     <----->      my application
>         |              BUS              |
> simple socket client            simple socket server

> 1.) the client trys to connect to the pc2, which is not in the ethernet
> network.
> 2.) my application notices this request...
> 3.) ... and sends it through the bus (with the character device driver
> functions)
> 4.) the application on the other side sends the message to the
> IP-network(maybe to the loopback device) and this way directly to the
> socket server.
> 5.) steps 1-4 in the other direction. pc2- pc1


 
 
 

network sockets

Post by Stephan Hurle » Wed, 12 Mar 2003 21:03:39



> Sorry,

> hab zu sp?t gemerkt, dass das hier ja eine deutsches Newsgroup ist...

where did you see that? did you crosspost to somewhere else? i was in the strong
belief this was an english-speaking NG, until now at least...

st

 
 
 

network sockets

Post by Guido » Wed, 12 Mar 2003 21:09:16




>> Sorry,

>> hab zu sp?t gemerkt, dass das hier ja eine deutsches Newsgroup ist...

> where did you see that? did you crosspost to somewhere else? i was in the
> strong belief this was an english-speaking NG, until now at least...

yes, i post it also to de.comp.lang.c (german) and my answer was directed to
c.o.l.networking. my fault:-) you're right.

cu
Guido

Quote:> st

 
 
 

network sockets

Post by acruxi » Wed, 12 Mar 2003 21:18:29



> Hi,

> i have a small socket or linux problem: Can anybody tell me how to develope
> a socket application reading IP messages which are not directed to my pc
> (have an other IP adress)? I wrote a socket application, but it couldn't
> access IP-messages directed to other pcs in the network.

> thanks,

> Guido

> background:

> i want to program a "router", which sends IP-Messages through a small bus.
> Now i have a character device driver for this bus system and 2 linux
> systems connected with this network. Due to the complexity of kernel
> development I don't want to write a new linux network driver. so i decided
> to develope an application which has a thread for listening to a
> TCP/IP-socket from an ethernet card in the first PC and another thread for
> reading messages from the bus simultanously.

> pc1: 192.168.1.1     <----->    pc2: 192.168.1.2
>   ethernet card         IP        no ethernet card
>   my application     <----->      my application
>         |              BUS              |
> simple socket client            simple socket server

> 1.) the client trys to connect to the pc2, which is not in the ethernet
> network.
> 2.) my application notices this request...
> 3.) ... and sends it through the bus (with the character device driver
> functions)
> 4.) the application on the other side sends the message to the
> IP-network(maybe to the loopback device) and this way directly to the
> socket server.
> 5.) steps 1-4 in the other direction. pc2- pc1

check out
man 7 packet, and
see if the option PACKET_OTHERHOST is what you want.
there's an option to receive all packets (promiscuous mode).

If this isn't what you want, you'll have to do some (not too much)
kernel hacking with /src/linux/net/*

 
 
 

network sockets

Post by Guido » Wed, 12 Mar 2003 21:43:59



> check out
> man 7 packet, and
> see if the option PACKET_OTHERHOST is what you want.
> there's an option to receive all packets (promiscuous mode).

> If this isn't what you want, you'll have to do some (not too much)
> kernel hacking with /src/linux/net/*

thanks, acruxis, for your answer,
i'll try it, on the first look at the manual pages it seems to be a really
good tip! i didn't know that the linux manual gives such good hints. I am
really windows-mared...("please contact your system administrator") :-)

Guido

 
 
 

1. Network sockets... without network!

Hi. I got LINUX up and running a few weeks ago and now have one major
problem:

How do I setup LINUX so that I can use Berkely Internet Sockets for
testing and program development on an un-networked local machine? I
tried to install the n-series but I can't assign an Internet address
to my machine or access the 'socket' functions!

Anyone have any answers or anyone with experience developing network

Thanks so very much!

C.Y.Wong
Imperial College, UK

2. moving users

3. Forcing xdm/dtlogin/gdm to use network socket...

4. WABI and APPLE DISKs

5. Where to find docs of Network/Socket Programming API of Linux Kernel 2.4.7?

6. Am I attacked by hacker?

7. Tool that show network socket idle time

8. Email aliasing MX

9. Network Sockets [Solaris 2.4]

10. Using fgets on network sockets

11. network socket connections

12. network socket -- closed?

13. Linux 2.4.1 network (socket) performance