Previous: , Up: The Skeleton: first-service.c   [Contents]


4.1.2 Breaking Down the Code

Look past the boilerplate and three library pieces are doing almost all the work. st_server_new and st_server_start put your I/O on the wire—ask for port 0 and the library finds a free one for you. The arrays you pass are shared, not copied: when your sensor value moves, the server already knows; when the Core writes an output, your code hears it. Then st_mdns_new and st_mdns_publish_service shout the service name and port across the LAN so the Core can find you without a map. The full contracts live under api-st-server and api-mdns; here you only need the story.