Hello,
I am attempting to interface with Quickstep using its NetworkCliClient
and it's not working as I would expect. I have the default port and IP
set to 3000 and 0.0.0.0 and am attempting to send single queries to be
processed over in my test harness. From what I could tell of the code
when QS is in network mode it accepts a socket connection and string
input from that function and processes it in NetworkCliClient.hpp and
NetworkCliClientMain.cpp, and yet this is not happening with my test
code. The connection is being established but Quickstep does not seem to
be doing anything with the queries that come in.
Attached is the test code that I am using. test is just a table by that
name, I'm selecting a literal from it so the contents shouldn't matter.
I've also attempted to create a table with this but Quickstep did not
process that.
--
Regards,
Dylan Bacon
University of Wisconsin - Madison
Department of Computer Sciences
dba...@wisc.edu
// Client side C/C++ program to demonstrate Socket programming
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#define PORT 3000
int main(int argc, char const *argv[])
{
struct sockaddr_in address;
int sock = 0, valread;
struct sockaddr_in serv_addr;
char *query = "SELECT 1 FROM test;";
char buffer[1024] = {0};
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
printf("\n Socket creation error \n");
return -1;
}
memset(&serv_addr, '0', sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
// Convert IPv4 and IPv6 addresses from text to binary form
if(inet_pton(AF_INET, "0.0.0.0", &serv_addr.sin_addr)<=0)
{
printf("\nInvalid address/ Address not supported \n");
return -1;
}
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
{
printf("\nConnection Failed.\n");
return -1;
}
send(sock, query, strlen(query), 0);
printf("Query sent.\n");
valread = read(sock, buffer, 1024);
printf("%s\n",buffer );
return 0;
}