I am doing a network relay program using socket programming to connect all the nodes.
Basically, the server will connect to one client and will pass an information to it.
The information that i want to send is a .txt format (text file).As far as I know, it is very difficult to send text file over socket.
So, I think it will be better for me to send the data as a string.
This is my partial code to send the array of string.
1 2 3 4 5 6 7 8 9 10
|
//send data to client
string list[];
for (int n=b-1;n>=0; n--)
{
list[n]=path2[n];
sckt::byte data[256];
strcpy(data,list[n].c_str() );
sock.Send(data,sizeof(data));
}
|
in sckt.h, byte define as follows
1 2
|
typedef unsigned char byte;
M_SCKT_STATIC_ASSERT(sizeof(byte)==1);
|
and it gives this error:
error:invalid conversion form 'sckt::byte*' to 'char*'
error:initializing argument 1 of 'char* strcpy(char* , const char*)'
can anyone help me please..
and I hope that my question is clear =)
Thanks in advance