Author Topic: Networking: socket() returns positive `non-socket`  (Read 688 times)

agena.info

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
    • View Profile
    • Agena Programming Language
Networking: socket() returns positive `non-socket`
« on: July 05, 2025, 07:10:41 pm »
Hello,

I am having a big problem with socket programming in C:

Every time I open a socket with:

int sock = socket(AF_INET, SOCK_STREAM, 0);

and try to bind or connect later on I get an 88 error code, claiming that these functions have been called with a non-socket (`Socket operation on non-socket`).

The result returned by socket is always a positive integer, mostly starting from 3.

I even included a call to the undocumented addsockettolist() function after opening the socket, but to no avail.

What am I doing wrong ?  I use ArcaOS 5.0.6 and Paul Smedley's GCC 4.4.6 and 8.3.0.

The C code that is run on ArcaOS to open, bind, connect, etc. is the very same as with Windows, Solaris, Linux, Mac OS X, where everyting works fine.

Any help would be appreciated.

Thank you,

Alex

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5481
  • Karma: +133/-1
    • View Profile
Re: Networking: socket() returns positive `non-socket`
« Reply #1 on: July 06, 2025, 09:03:07 pm »
I'd patiently wait for a response from someone who knows this stuff. For many it is a long weekend.
Which headers are you using? Are you linking against libcx (-lcx). Also what cflags/ldflags are you using?