title: In this case, How do i use char pointer?(SOCKET Programming in windows)
body: <p>attention under codes</p>
  
  <p>SERVER.c </p>
  
  <pre><code>char* message = "hel";
  send(clientsock, &amp;message, 3, 0); 
  </code></pre>
  
  <p>CLIENT.c    </p>
  
  <pre><code>char** message = NULL;
  messageLen = recv(clientsock, **message, 2, 0); 
  </code></pre>
  
  <p>My plan is SERVER.c source in char* message = "hel" send to CLIENT.c source in char** message. but it doesn't work, what i do to my plan do ?</p>
  
  <p>Server.c Full source</p>
  
  <pre><code>#pragma comment(lib, "ws2_32.lib")
  #define _CRT_SECURE_NO_WARNINGS
  #include &lt;stdio.h&gt;
  #include &lt;WinSock2.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define PORT 1234
  #define BACKLOG 10
  
  
  
  int main(int argc, char * argv[]) {
  
  SOCKET sock, clientsock;
  WSADATA wasData;
  struct sockaddr_in sockinfo, clientinfo;
  int clientsockSize;
  char* message = "hel";
  
  
  if (WSAStartup(MAKEWORD(2, 2), &amp;wasData) != 0) {  //int WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData);
      return 0;
  }
  
  sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // socket( AF_INET , type , protocol)
  
  if (sock == INVALID_SOCKET) {
      return 1;
  }
  
  sockinfo.sin_family = AF_INET;
  sockinfo.sin_port = htons(PORT); // 
  sockinfo.sin_addr.s_addr = htonl(INADDR_ANY);
  
  if (bind(sock, (SOCKADDR*)&amp;sockinfo, sizeof(sockinfo)) == SOCKET_ERROR) { // int bind (sock , (SOCKADDR*)&amp;sockinfo , sizeof(sockinfo)) if true : return 0, else -1
      return 2;
  }
  
  if (listen(sock, BACKLOG) == SOCKET_ERROR) {  // Int listen ( SOCKET , backlog )
      return 3;
  }
  
  
  clientsockSize = sizeof(clientinfo);
  
  printf("접속 대기중...\n");
  
  clientsock = accept(sock, (SOCKADDR*)&amp;clientinfo, &amp;clientsockSize); 
  
  
  if (clientsock == INVALID_SOCKET) {
      return 4;
  }
  
  printf("Send your message &gt;&gt; ");
  
  send(clientsock, &amp;message, sizeof(message), 0);  
  
  closesocket(sock);
  closesocket(clientsock);
  
  WSACleanup();
  
  return -1;
  
  }
  </code></pre>
  
  <p>CLIENT.c Full source</p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS
  #define _WINSOCK_DEPRECATED_NO_WARNINGS
  #pragma comment(lib, "ws2_32.lib")
  
  #include &lt;stdio.h&gt;
  #include &lt;WinSock2.h&gt;
  
  
  int main(int argc, char* argv[]) {
  
  SOCKET clientsock;
  WSADATA wasData;
  struct sockaddr_in sockinfo;
  
  char** message = NULL;
  
  int messageLen;
  
  if (argc != 3) {
      printf("Argument is not sufficient!\nInputed Argument &gt;&gt; %d", argc);
      exit(1);
  }
  
  if (WSAStartup(MAKEWORD(2, 2), &amp;wasData) != 0) {
      printf("Error &gt;&gt; Init WSAStartup(..)\n");
  }
  
  clientsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (clientsock == INVALID_SOCKET)
      printf("Error &gt;&gt; socket(..)\n");
  memset(&amp;sockinfo, 0, sizeof(sockinfo)); // 구조체 초기화
  
  sockinfo.sin_family = AF_INET;
  sockinfo.sin_port = htons(atoi(argv[2]));
  sockinfo.sin_addr.s_addr = inet_addr(argv[1]);
  
  if (connect(clientsock, (SOCKADDR*)&amp;sockinfo, sizeof(sockinfo)) == SOCKET_ERROR)
      printf("Error &gt;&gt; connect(..)\n");
  
  messageLen = recv(clientsock, **message, sizeof(message) - 1, 0);
  if (messageLen == -1)
      printf("Error &gt;&gt; recv(..)\n");
  
  printf("Server say &gt;&gt; %s", message);
  closesocket(clientsock);
  WSACleanup();
  
  }
  </code></pre>