lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I implemented a server with the C language and all messages it receives begin with a 4-byte integer that defines the type of message.

I tried to create a client program with Lua Socket library for that server but I noticed that the send( ) function of this library sends only strings. The problem is that if I send the string "1" the server receives only one byte instead of 4 bytes required to define the type of message.

Is there any way to send a 4-byte integer with the function send ()? Or some way to convert the lua string "1", for example, to the bytes corresponding to C-integer 1?