Gog is dead, at least for now


Today was UDP and connectivity day. To allow the ants to have a distributed network in the same way they would if it were a distributed nano form, I decided to experiment with UDP. In an asteroid belt where many cooperating automatons operate, they would need to communicate, but because of speed of light delays and other considerations it would not be possible to use a connection. Limited memory means they would need to deal with a local scope only and a C&C structure would be out of the question.

The meerkat has arrived and it should be tested, but I am busy with the Eye of Infinity.


int UDP_start() { int pchild;int sockquit=0; if ( (pchild = fork()) == 0 ) { if ((s1 = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {printf("Error socket\n");return 1;} sock_server1.sin_family = AF_INET; sock_server1.sin_port = htons(PORT1); sock_server1.sin_addr.s_addr = htonl(INADDR_ANY); if ( fcntl( s1, F_SETFL, O_NONBLOCK, 1 ) == -1 ) {printf( "failed to set non-blocking socket\n" );} if (bind(s1, (struct sockaddr *) &sock_server1, socklen1) == -1) {printf("Error bind()\n");return 1;} create_X11_window();

The socket has its own thread and window in this case. It is surprising how much easier it is when a person understands what the terminology means. "enum, -> object.element, assert, #define, ||, &addressOf" and a hundred others. It was very irritating and frustrating to look at code when everything is new and the symbols are unknown. C is easy, but I am not so sure that I actually like C++ as it seems to wind itself around the axle of the CPU with out any help at all.

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen