Client-server C program

Just tried it and it works fine for me.

I added some printfs when the program was terminating because of error. I started gns -s on machine 1 then gns -c on machine2 , then started the program with -s ( as root ) on machine 1. Ran the program with -c n machine 2 and got 2 prints on both server and client

My guess is you didn’t start the server as root and it was terminating right away.

Or you don’t even have qnet running ( it’s not by default ).

I did run it as root.
If I start gns than Qnet may not be working?
If so than how to check if it’s running and how to run it?
I’ll try again from start. Maye you can write me what I should pay special attention to?

Btw I used some printfs too :slight_smile: Program working as client always exits after name_open().

For run QNET at startup, create empty file: /etc/system/config/useqnet

Then it would have been nice if you posted the code that you tried :wink:

And what is the value of errno?

If you have a directory call /net then qnet is running.

It was the same only in each exit I had my special printf(“dupa1…n”)
Thats how I know it was in name_open()
I’ll back to QNX on Saturday and then I’ll write how I’m going.

I had /net directory so QNet was working.

Simply add “/net/nodename” before the path to the file on the server.

No, actually. Your server has a name, which you can find by going to your network configuration on the network tab, where it says “Host Name:” If you don’t supply anything, QNX will generate a semi-random name like “EA33a7ae”, or else you can type in something meaningful. By the way, this may be the problem you are having with gns. The -s isn’t the name of the server APPLICATION, it’s the node (host) name of the MACHINE the server is running on.

Well, it WAS this difficult. Three years ago or so. It turns out no one from QNX ever bothered to point gns out to me. It’s not listed in the “New Content” section of the 6.3 documentation (any version), even though it was NOT in 6.2.1. So I’m really glad you asked this question because I sure just learned something.

-James Ingraham
Sage Automation, Inc.

You’re supposed to run

gdb -c , it has nothing to do with your ATTACH_POINT.

That’s probably your problem.

You mean gns -c . lol!

LOL - my fingers are used to typing gdb and they did it on their own, with no input from my brain! :slight_smile:

First of all thank you all for your help.
Now it’s working… I was making few mistakes :frowning:

  • QNet on client’s computer wasn’t running
  • on client I was using gns not I supossed to

Btw can I do something to run gns automatic after system starts?

Put gns in /etc/rc.d/rc.local