Is it possible to tell whether a network socket is/will be a real time socket or a regular socket runtime?
Hi list
Is there a way that I can tell if a network socket is a real time socket or a regular socket runtime ?
Usually I always know beforehand whether something is going to be a real time socket or a std posix socket. Now it will depend on the host-address.
I have this posix-skin application that can be both real time and non real time depending on available network hardware. Because of the differences between RTNet and regular posix net implementation i sometimes have to choose between setsockopt/ioctl when setting the properties. Therefore I need to handle a few lines of code differently depending on the situation.
This brings up another issue I have been struggling with for the posix-skin. When, in this snippet of code, is it decided whether __std or __cobolt functions are executed ?
Is it run-time or compile time ? If runtime, is it during the connect or during the sendto ?
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(host_name);
serv_addr.sin_port = htons( portno );
sockfd = socket(AF_INET, SOCK_DGRAM,0);connect( sockfd, ( struct sockaddr * ) &serv_addr, sizeof( serv_addr)) sendto(sockfd, (char*) &packet, sizeof( packetType ), MSG_DONTWAIT, NULL, sizeof( serv_addr ));
Regards
Per Öberg
----- Den 1 okt 2020, på kl 9:41, xenomai <[email protected]> skrev:
Quoted 13 lines
Hi list
Is there a way that I can tell if a network socket is a real time socket or a regular socket runtime ?
Usually I always know beforehand whether something is going to be a real time socket or a std posix socket. Now it will depend on the host-address.I have this posix-skin application that can be both real time and non real time depending on available network hardware. Because of the differences between RTNet and regular posix net implementation i sometimes have to choose between setsockopt/ioctl when setting the properties. Therefore I need to handle a few lines of code differently depending on the situation.
Quoted 6 lines
This brings up another issue I have been struggling with for the posix-skin. When, in this snippet of code, is it decided whether
__stdor__coboltfunctions are executed ?Is it run-time or compile time ? If runtime, is it during the connect or during the sendto ?
I ended up doing an ugly hack usinggetifaddrs(&ifaddr) and matching for the IP/Netmask i am connecting to. Then I do
__STD(socket()) or __COBALT(socket()) depending on the result. After that i use regular connect / sendto / recvfrom without macros.
So: If it's an RT socket already after the call to "socket" the wrapper will know that its a RT socket and use the correct functions hereafter ??
Quoted 10 lines
serv_addr.sin_family =
AF_INET;
serv_addr.sin_addr.s_addr =inet_addr(host_name); serv_addr.sin_port = htons( portno );
sockfd =socket(AF_INET, SOCK_DGRAM,0);connect( sockfd, ( struct sockaddr * ) &serv_addr, sizeof( serv_addr))sendto(sockfd, (char*) &packet, sizeof( packetType ), MSG_DONTWAIT, NULL, sizeof( serv_addr ));Regards
Per Öberg
Regards
Per Öberg