<commit_before>/*
  Copyright (C) 2000-2013
  <EMAIL>
*/

#include <stdio.h>
#include <stdlib.h>

#include "wsutils.h"

#define BUF_LEN (512)

static 
int test_tcp_client(const char* ip, short port)
{
  char buf[BUF_LEN];
  SOCKET s;
  int i;
  int len;
  int result;

  sprintf(buf, "%s", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

  s = start_client_connection(ip, port);
  if (s == SOCKET_ERROR || s == INVALID_SOCKET) {
    printf("%d connecting failed\n", WSAGetLastError());
    return -1;
  } 

  for (i = 0; i < 32; ++i) {
    len = strlen(buf);
    result = send(s, buf, len,  0);

    fprintf(stdout, "%d -> Send result %d\n", i, result);

    if (result == -1) {
      fprintf(stdout, "%d -> Send message failed.\n", i);
      break;
    }

    recv(s, buf, len, 0);

    fprintf(stdout, "%s\n", buf);

    Sleep(5);

  }
  closesocket(s);

  return 0;
}


int main(int argc, char* argv[])
{	
  char ip[MAX_PATH + 1] = "192.168.1.108";
  short port = 8000;
  if (argc > 2) {
    _snprintf(ip, MAX_PATH, "%s", argv[1]);
    port = atoi(argv[2]);
  } else if (argc > 1) {
    _snprintf(ip, MAX_PATH, "%s", argv[1]);
  } else {
    printf("Usage: sendutils.exe IP PORT\n");
    return -1;
  }
  printf("User enter IP:%s, PORT:%d\n", ip, port);

  init_socket();

  test_tcp_client(ip, port);<commit_msg>Added the [] on usage help information<commit_after>/*
  Copyright (C) 2000-2013
  <EMAIL>
*/

#include <stdio.h>
#include <stdlib.h>

#include "wsutils.h"

#define BUF_LEN (512)

static 
int test_tcp_client(const char* ip, short port)
{
  char buf[BUF_LEN];
  SOCKET s;
  int i;
  int len;
  int result;

  sprintf(buf, "%s", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

  s = start_client_connection(ip, port);
  if (s == SOCKET_ERROR || s == INVALID_SOCKET) {
    printf("%d connecting failed\n", WSAGetLastError());
    return -1;
  } 

  for (i = 0; i < 32; ++i) {
    len = strlen(buf);
    result = send(s, buf, len,  0);

    fprintf(stdout, "%d -> Send result %d\n", i, result);

    if (result == -1) {
      fprintf(stdout, "%d -> Send message failed.\n", i);
      break;
    }

    recv(s, buf, len, 0);

    fprintf(stdout, "%s\n", buf);

    Sleep(5);

  }
  closesocket(s);

  return 0;
}


int main(int argc, char* argv[])
{	
  char ip[MAX_PATH + 1] = "192.168.1.108";
  short port = 8000;
  if (argc > 2) {
    _snprintf(ip, MAX_PATH, "%s", argv[1]);
    port = atoi(argv[2]);
  } else if (argc > 1) {
    _snprintf(ip, MAX_PATH, "%s", argv[1]);
  } else {
    printf("Usage: sendutils.exe [IP] [PORT]\n");
    return -1;
  }
  printf("User enter IP:%s, PORT:%d\n", ip, port);

  init_socket();

  test_tcp_client(ip, port);
{'fraction_non_alphanumeric': 0.1849754624386561, 'fraction_numerical': 0.03850509626274066, 'mean_word_length': 2.973013493253373, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1616856', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1071, 'n_words': 272}