Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
#include <sp.h>
#include <assert.h>
#include <stdio.h>
int main (int argc, char *argv[])
int sock, rc;
struct sockaddr_sp addr;
char buffer [1024];
ssize_t nbytes;
/* Create an SP socket. */
sock = socket (PF_SP, SOCK_SUB, 0);
assert (sock);
/* Connect it to the supplied endpoint */
memset (&addr, 0, sizeof addr);
addr.ssp_family = AF_SP;
strcpy (addr.ssp_endpoint, "tcp://");
rc = connect (sock, (struct sockaddr *)&addr, sizeof addr);
assert (rc == 0);
while (1) {
/* Receive a message */
nbytes = recv (sock, buffer, sizeof buffer, 0);
assert (nbytes >= 0);
/* Print the content as a string */
buffer [nbytes] = 0;
printf ("received <%s>\n", buffer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.