title: streaming with tcp using opencv and socket
body: <p>i have done simple tcp client/server program got working well with strings and character data...i wanted to take each frames(from a webcam) and sent it to server.. here is the part of client program where error happened:</p>
  
  <pre><code>line:66   if(send(sock, frame, sizeof(frame), 0)&lt; 0)
  </code></pre>
  
  <p>error:</p>
  
  <blockquote>
    <p>client.cpp:66:39: error: cannot convert ‘cv::Mat’ to ‘const void*’ for argument ‘2’ to ‘ssize_t send(int, const void*, size_t, int)</p>
  </blockquote>
  
  <p>i cant recognise this error....kindly help...the following complete client program:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;sys/socket.h&gt; 
  #include&lt;netinet/in.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;netdb.h&gt; 
  #include&lt;unistd.h&gt;
  #include "opencv2/objdetect.hpp"
  #include "opencv2/highgui.hpp"
  #include "opencv2/imgproc.hpp"
  #include &lt;iostream&gt;
  
  using namespace std;
  using namespace cv;
  
  
  int main(int argc,char *argv[])
  {
      int sock;
  struct sockaddr_in server;
  struct hostent *hp;
  char buff[1024];
  VideoCapture capture;
      Mat frame;
  capture.open( 1 );
      if ( ! capture.isOpened() ) { printf("--(!)Error opening video capture\n"); return -1; }
  
  begin:
  capture.read(frame);
  
  if( frame.empty() )
      {
          printf(" --(!) No captured frame -- Break!");
          goto end;
      }
  
  sock=socket(AF_INET,SOCK_STREAM,0);
  if(sock&lt;0)
  {
      perror("socket failed");
      exit(1);
  }
  
  server.sin_family =AF_INET;
  
  hp= gethostbyname(argv[1]);
  if(hp == 0)
  {
      perror("get hostname failed");
      close(sock);
      exit(1);
  }
  
  memcpy(&amp;server.sin_addr,hp-&gt;h_addr,hp-&gt;h_length);
  server.sin_port = htons(5000);
  
  if(connect(sock,(struct sockaddr *) &amp;server, sizeof(server))&lt;0)
  {
      perror("connect failed");
      close(sock);
      exit(1);
  }
  int c = waitKey(30);
      if( (char)c == 27 ) { goto end; }
  if(send(sock, frame, sizeof(frame), 0)&lt; 0)
  {
      perror("send failed");
      close(sock);
      exit(1);
  }
  goto begin;
  end:
  printf("sent\n",);
  close(sock);
  
      return 0;
     }
  </code></pre>