}
server_address_ip = cs_straddr(stack, server_address_str);
- if (!server_address_ip)
- {
+ if (!server_address_ip) {
fprintf(stderr, "cs_straddr: address could not be resolved\n");
return -1;
}
status = cs_connect(stack, server_address_ip);
- if (status != 0) {
+ if (status) {
fprintf(stderr, "cs_connect: %s\n", cs_strerror(stack));
return -1;
}
+ status = cs_rcvconnect(stack);
+ if (status) {
+ fprintf(stderr, "cs_rcvconnect: %s\n", cs_strerror(stack));
+ return -1;
+ }
+
status = cs_put(stack, protocol_package, protocol_package_length);
if (status) {
fprintf(stderr, "cs_put: %s\n", cs_strerror(stack));
return -1;
}
- /* Now get a response */
+ /* Now get a response */
length_incoming = cs_get(stack, &buf, &size);
if (!length_incoming) {
fprintf(stderr, "Connection closed\n");
/* clean up */
cs_close(stack);
if (buf)
- free(buf);
+ xfree(buf);
return 0;
]]>
</programlisting>
}
server_address_ip = cs_straddr(stack, server_address_str);
- if (!server_address_ip)
- {
+ if (!server_address_ip) {
fprintf(stderr, "cs_straddr: address could not be resolved\n");
return -1;
}
status = cs_connect(stack, server_address_ip);
- if (status != 0) {
+ if (status) {
fprintf(stderr, "cs_connect: %s\n", cs_strerror(stack));
return -1;
}
+ status = cs_rcvconnect(stack);
+ if (status) {
+ fprintf(stderr, "cs_rcvconnect: %s\n", cs_strerror(stack));
+ return -1;
+ }
+
status = cs_put(stack, protocol_package, protocol_package_length);
if (status) {
fprintf(stderr, "cs_put: %s\n", cs_strerror(stack));
}
/* Now get a response */
-
length_incoming = cs_get(stack, &buf, &size);
if (!length_incoming) {
fprintf(stderr, "Connection closed\n");
/* clean up */
cs_close(stack);
if (buf)
- free(buf);
+ xfree(buf);
return 0;
}