Skip to content

@sustrik /gist:1372839
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
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://127.0.0.1:1111");
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.