This forum has been archived. Please start a new discussion on GitHub.

how to pass binary char array to remote host efficiatively?

hi ICE-team:
i will attempt to pass char array ( char buff[1024]) to remote host via ICE enigine,in ICE ,must covert buff to sequnce<Byte>,it map to std::vector<Byte>,its capablity is not good at speed, i don't known how to resolve this problem.


  • Please see this post regarding our support policy:
  • Dear Marc,Give me any advise

    Dear Marc,Give me any advise
  • You can only transfer a vector<Byte>, but not a byte array. In my experience, the overhead of a vector<Byte> is very small. For example, IcePatch uses vector<Byte>, too, and the speed equals that of FTP. You can also try the throughput performance tests in demo/Ice/throughput.

    If you measure performance, make sure to use optimization. The speed of STL containers depends a lot on inlining and other optimization features. In addition, STL containers also often have additional checks in debug mode that lower performance.
  • very thanks!

    very thanks
  • other

    in our application ,we will tranfer variant media stream(video/audio) from client to server,high-speed is important. in pass,we create raw tcp/udp socket at both side, push stream-bytes into socket .example:
    streambuff = new Byte[1024*10]
    sk = socket(AF_INE,SOCK_STREAM,0);
    ret = caputreVideoStream(streambuff,1024)
    ret = packRTP(streambuff,ret)
    that's ok!
    and now if using vector<Byte>, i known ice also will implement above socket-operation,so i consider application cost is expansive.
  • I'm not sure what exactly the question is. Is the question how to use vector<Byte> efficiently with raw sockets?
  • matthew
    matthew NL, Canada
    I think that the network overhead (ie: the cost in sending and receiving the data over TCP/IP) will make the application inefficiency you are referring too (essentially a memory allocation and data copy) totally insignificant. Have you measured a real difference in a real world application?