How does Net work?

I know that Net is a bridge between Ethernet Card and applications. We have to register with Net if we want to use one of our network drivers.But how does Net work?
Once a packet was received by a network driver, did it tell Net to access it’s own buffer to get the packet? And how did Net dispose it if the buffer
where Net wanted to fill this packet to was full at this time?
In a word, how does Net work between the network drivers and the application?
If i have more than one Ethernet card in my machine, will Net be confounded?


Is that related to your other post on the netraw interface? Ok so you want to write a Network driver. (that’s not the same as netraw). QNX has never made public any SDK/documentation/sample/example/template to write a network driver. Unless you have a good business case or close relation with QNX it’s very unlikely QNX will help you to write a driver.

Not all is lost though. QNX provides a network driver call Net.fd. This is a network driver that interface with a device (like a serial port) to read/write data. If you make your driver look like an io device you are in business! How to write such an io driver is described in /etc/readme/technotes/Net.fd (there is some C code to get you started).

I have done network driver using Net.fd and it works well (although it’s a little messy)

Thank you for your answer, Mario.
I’m sorry for my pool English :-}
I want to know how does Net work between a Ethernet Card( device ) and the application.
One there was a packet sent to my Ethernet Card, would it be transmitted to the application in the following sequence?

  1. Net was interruptted by the Eth-Card and got the packet from the buffer of the Eth-Card;
  2. Net wrote the packet into the buffer ( if there were some empty ones )registered with it by application and trigger the proxy of my application;
  3. And next, when the application got the signal sent by Net, it got the packet from the buffer above.
    In the second step, if there wasn’t any empty buffer to write, how did Net do? Would it drop the packet immediately?
    Thank you.

Your description is accurate if you are referring to a netraw application.

Net would “drop” the packet (for your particular application). If there were no buffers available for your app. The way that Net would know that there are no buffers for your app is by calling a function you provide to get a buffer, and if it returns a NULL the packet is dropped.

It`s a little more complicated then that, but it is accurate enough. As rgallen hinted, Net is able to directly called code inside the Network driver and/or netraw application to handle the allocation of buffers and data storage. That is one of the reason QSS is not keen to make the code public. Network driver are closely tied to Net and indirectly to Proc.

There is typicaly no Net <-> application interface per see, because all exchange of data goes through a program that handles the protocol, Net/Proc (they are tightly couple) and TCP/IP are two examples. TCP/IP will receive the data from Net via its netraw interface but will actually buffer the data to be sent to via TCP/IP standard API. Same thing for application making use of QNX messaging.

The only applications that can receive packet directly are netraw applications. In a standard QNX installation only TCP/IP uses the netraw interface.

Maybe if you care to describe what it is you are trying to acheive, we can be more precise in our comments.

My dear friends.
I think it’s difficult to know how does Net work, isn’t it?
If i want to make my program run in the netraw mode, is it necessary that Net.fd must be started up?
I found Net and Net.fd were both in use in some sample codes. I have been muddled by this!
I could get rid of Net.fd if i told my program to register with Net, couldn’t i? I consider that i can catch all packets passed to me from Net, and i will never need Net.fd itself.
It’s so complicated!
Are there any relations between Net and Net.fd? Would Net.fd register with Net as some programs do?
If not, how can Net.fd get the packets?
Thanks in advance.

What exactly do you want? Get Tcpip5, and probably you could just forget everything about Net :slight_smile:

yes it’s difficult to know how Network for the simple reason that you don’t have to.

Netraw mode is independant of the driver, it works with any network driver.

Net is the manager and Net.fd/Net.ether2100/Net.ether1000 are all network driver.

Net.fd is a special driver that instead of talking to hardware directly taslk to another dirver (like a serial port driver).

You need to use Net.fd is you are writting a driver that will talk with the hardware.

You need to use netraw if you want your application to send/receive Ethernet packet via an existing driver.

Please describe what you need to acheive from a higher level and describe the hardware? Convince me you need to use netraw…

  • Mario

Yes i want to use the netraw mode.
Would you like to tell me how can connect to another machine please( using Net.fd )?

And dear Xtang, where can i get TCPIP5?

Why do you want to use Netraw?

What type of machine (OS) you want to connect to and with what kind of medium (ethernet, serial, wireless etc).

Hmilzy, please take the time to give more details, either you are a lazy typer or you are so new at this that you don’t even know what question to ask.

This is the last time I asked after that I give up, WHAT TASK ARE YOU TRYING TO PERFORM. DON’T TELL ME YOU WANT TO USE NETRAW. Are you working on robot controler that needs to talk to custom robot. What type of device do you need to interface with! You can’t go and ask “I do I connect to another machine”. It’s like asking I do I get home. Well the answer depends how far away from home you are, how fast you want to get home, how much money you have, etc. BE VERSBOSE :slight_smile:))

Last time I looke TCPIP5 was not available anywhere on You will have to contact qnx sales

tcpip v5 was on … index.html

but the new website somehow missed that. If you go to the new qnx4 download center: you don’t see v5 under the tcpip category.

I would suggest contacting so that they can fix it.

You really should anwser Mario’s question first before you want to go further. Some info may just leads you to a dead end.

To answer your question, there is a “Virtual Packet Interface” in Tcpip5 which allow you processing “Packets” to/from stack.

Dear Mario. I’m so sorry for my poor knowledge of the network module of Qnx4. I’m sorry.
I bought Qnx4 from QNX but only got a few datum which just introduces some commands in Qnx4.
And my machine works as a switch to provide services to Cable Modems( CM ) using DOCSIS protocol; The machine( CMTS ) connect with CMs using RF-cable and with ethernet to communicate with outer side.
All CMs get/receive data through cable. And when they send something out, i can get the messages and give them to Net at last if destination is outer side, and Net will send them to the Ethernet Card. Net should get all messages sent from outer and buffer them into the buffer specified by my program. Then i can deal with the messages and so than i can decide where to send them to( by the dest-Mac-addresses ).
I really do not know how does Net.fd work with it’s device prefix( /dev/bcmnet_fd ) in the codes provided by Broadcom because it is a virtual prefix and not a serial port or any other devices.
Would you give me some suggestions or would you like to show me where can i get some information of the network in Qnx4?
Thanks in advance.

Please don’t apologizes for lack of knowledge, we are here to share knowledge ;-))

A few questions to make sure I fully understand your setup. The CM is connected to the machine running QNX via a ethernet cable. The QNX machine has more then one network cards (one for CM and then extra network card to send data on)? Your software should receive the packet and then decide on what network card to send it. Further more all packets received on the network card not connected to the CM has to be read and send to the CM, bidirectional communication?

I don’t see where this Broadcom driver fits, is that the driver for a special ethernet card? What is the code provided by Broadcom good for? Why do you need code from Broadcom.

I’ll give you suggestions as soon as I fully understand what you are trying to do :wink:

Aside from what was already mention there is no other documentation. It’s all about asking around and learning through experience!

CMs are connected with the machine by some RF-cables( common TV line ), not ethernet cable. If they want to communicate with outer side network, then will send all messages through the TV-lines and the machine has to work as switch to send the messages out. ( and the machine connect to the internet with a ethernet interface ). When the answers returned from internet, the machine will check the destination MAC addressed to decide which CM will get the messages, and then sends to it through the TV-cables.
All packets from outer side should be received on the ethernet card and will be sent to CMs through the TV-cable.
And the prefix of Net.fd is just a virtual device, and i am sure Net.fd should be bound with the ehternet card above, but i don’t know how does Broadcom achieve that.
If i want to assign a virtual prefix to Net.fd and i want Net.fd to use a special Ethernet card, how can i finish that? ( I don’t find any device descriptor which bound to a Ethernet card in /dev/. )
Thanks in advance.

Ok picture is getting clearer now. The QNX machine has a card that uses RF-Cable to connect to the CM and that card comes with a driver made by Broadcom (or who ever). When you start the driver it creates /dev/bcmnet_fd?

I understand now. I beleive the broadcom driver is a network driver that let Net.fd connect to it and not a driver that connects to Net. This is just an assumption, this needs to be confirm with the people responsible for that driver.

You should be able to use it with Net.fd just like if it was a serial port. Check Net.fd documentation. The sequence to support it would look like:

Net &
broadcomdriver (what ever its name is ) &
Net.fd /dev/broadcom_fd

Voila! You may have to specify option -a, -c, -b to Net.fd depending on how the broadcom driver is design. Note -b is an undocumented option…

At this point QNX is able to use the boardcom driver just like if it would be a standard network driver. This can actually cause some unwanted side effect. QNX may decide to send packet on it’s own on the RF-cable, which I beleive you want to avoid. You have to make sure there is no entry in the netmap database about the broadcom card. You also have to make sure TCP/IP is not started, otherwse the TCP/IP stack may send data on that interface, which I don’t think would be good in your case.

The next step is to write a netraw program that binds with all the network cards (ethernet and broadcom) and with all the ethernet protocols type. The fact that the broadcom driver is accessed via Net.fd is totaly transparent to Net and to any program using the netraw interface.

You will probably have to set the ethernet driver to Promiscuous mode to be able to receive packet with ANY destination MAC addresses (typicaly network card reject packet that don’t have the proper destination MAC address).

Does that answer your questions?