#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <sys/ioctl.h>
#endif
#include <errno.h>
#include "protocol.h"
-#include <sys/ioctl.h>
-
#define BUFFER_SIZE 4
/* Top-level command opcodes */
static gboolean data_available(struct ipdbg_la_tcp *tcp)
{
#ifdef __WIN32__
+ u_long bytes_available;
ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
+ return (bytes_available > 0);
#else
int status;
}
return (status < 1) ? FALSE : TRUE;
-#endif // __WIN32__
+#endif
}
SR_PRIV struct ipdbg_la_tcp *ipdbg_la_tcp_new(void)
static int tcp_send(struct ipdbg_la_tcp *tcp, const uint8_t *buf, size_t len)
{
int out;
- out = send(tcp->socket, buf, len, 0);
+ out = send(tcp->socket, (const char *)buf, len, 0);
if (out < 0) {
sr_err("Send error: %s", g_strerror(errno));
if (data_available(tcp)) {
while (received < 1) {
- int len = recv(tcp->socket, buf, 1, 0);
+ int len = recv(tcp->socket, (char *)buf, 1, 0);
if (len < 0) {
sr_err("Receive error: %s", g_strerror(errno));