int main(int argc, char *argv[])
{
+ if (argc < 2) {
+ fprintf(stderr, "Usage %s PORT\n", argv[0]);
+ ::exit(1);
+ }
+
+ mf624_io_status.portno = atoi(argv[1]);
mf624_io_status.DIN = 0;
mf624_io_status.DOUT = 0;
mf624_io_status.DA0 = 0;
void socket_thread::run()
{
#define STRING_BUFF_SIZE 256
- qDebug() << "Executing in new independant thread, GUI is NOT blocked";
+ //qDebug() << "Executing in new independant thread, GUI is NOT blocked";
int portno;
int n;
int val;
char buffer[256];
- //if (argc < 3) {
- // fprintf(stderr,"usage %s hostname port\n", argv[0]);
- // exit(0);
- //}
- //portno = atoi(argv[2]);
- portno = atoi("55555");
+
sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
- serv_addr.sin_port = htons(portno);
+ serv_addr.sin_port = htons(mf624_io_status.portno);
if (::connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
perror("connect()");
+ ::exit(1);
}