Re: sending structure client server



On Oct 11, 9:19 am, swetha <laptop...@xxxxxxxxx> wrote:
Hi ,
       I want to send a structure (user defined) for example :

struct bank{

int empid;
char name[50];
float amount;

} per;

I want to send this from a client to server on unix.Can any1 tell me
how to send this(from client) and read the data at the other end(at
server).tnx in advance...

1) Allocate a buffer the size of the data you're supposed to send.

2) Put the data from the structure into the buffer, following the
protocol specification to encode each field.

3) Call the 'send' or 'write' function.

4) On the other end, call 'recv' or 'read'. Read the data into a
character buffer.

5) Unpack the data into the structure following the protocol
specification.

DS
.



Relevant Pages

  • Re: sending structure client server
    ... I want to send this from a client to server on unix.Can any1 tell me ... You need a protocol specification first. ... The server doesn't follow the specification, ...
    (comp.unix.programmer)
  • Re: Socket write behaviour is inconsistent?
    ... copy 1 byte to buffer, copy many bytes to buffer, copy one byte to ... Then why did you write "the client throws an error"? ... remote endpoint for your connection. ... When the response is sent using the first chunk of code, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: TCPClient Synchronous or Asynchronous Writes
    ... acting as the "server" receives quality assurance data from different ... Each client can register to look at differnt data so there ... is actually a Circular Buffer for each client. ... >> stream data to my clients over a TCPClient connection. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: NIO best practice
    ... ByteBuffer buffer) { ... SelectionKey key=client.keyFor; ... ChannelState state=selkey.attachment; ... transfer_file(selkey, client, state); ...
    (comp.lang.java.programmer)
  • Re: USB data Transfer question
    ... I'm afraid you can't pass 1-byte length buffer ... the pBuffer!=0 if there is data sending from client. ... and both USB analizer and the pBuffer value is the ... and the write function which write data from USB host to client works ...
    (microsoft.public.windowsce.platbuilder)