Now I send messages using:
void SendToSocket(SOCKET &soc,string &str) { send(soc, str.c_str(), str.size() + 1, 0);//WinSock2.h } But in this way only the lines are "forwarded". How to transfer an arbitrary array of data? Type int[] , but so that they are guaranteed to come in their own order and not separate some characters (char) from there by the automaton during transmission or reception. Now the text sends the application to c ++, and receives the ubuntu terminal via telnet. Is it enough just to send and receive an unsigned char array instead of string?
char p[] = "Welcome!"; send(client, &p, sizeof(p), 0);char p[] = "Welcome!"; send(client, &p, sizeof(p), 0);gives an error thatconst char(*)is not aconst char*(talking aboutp). What am I doing wrong? - Vasily Pupkinpis already a pointer, you need to pass it right away, not&p. - RiotBr3akersizeofto determine the size of the array (4) do not check the resultsend@ RiotBr3aker No, in this examplepnot a pointer, it is an array . - VTTsendresult? There is no client application yet. - Vasily Pupkin