here are my requirements
very very simple indeed !
client:
send filename
send filesize
send file
server:
read fixed lenght of filename, filesize
allocate space for file
store file
send some command back
these tasks work fine on my loopback interface. since TCP doesnt loose
them in a real network, hope i can assure that it works
i use unsgined char buffers to read.
eg.
unsigned char *buffer=new unsigned char[size];
bzero(buffer,size);
i receive the files correctly.
do i have to send starting/ending sequences to mark the start/end of
packets.
for example.
after creating socket and calling connect();
i call at client
write(10 bytes);
write(15);
then at server i call
read(10);
read(15);
will i get what i send? will the server not read any garbage?
thanks
indika
--- In [email protected], "Nico Heinze" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "Indika Bandara" <indikabandara19@>
> wrote:
> >
> > hello,
> > i want to develop a application layer protocol to send
> > particular data (a file and some other text). how can
> > i start with this.
>
> Collect all your requirements, and then define an overhead protocol to
> fulfil all these. But you have to collect them all first.
>
> > my program can read(), write() with socket. i want to know
> > how can i implement reliabiltiy and other constraints i
> > have to look at.
>
> That depends on the underlying protocol, see next paragraph.
>
> > for example i can send the file to the other end with
> > write() and read() from there. but is that all? can some
> > packets get lost (using TCP sockets) and is there a limit
> > to the bytes in read() , write() once.
>
> Using TCP/IP: no; TCP/IP makes sure that either every TCP packet
> arrives in the correct order or that nothing arrives at all. There is
> no such thing as a partial delivery with TCP/IP. TCP/IP is a
> connection oriented protocol and takes care of such measures on its own.
> Using UDP/IP: yes; UDP is more of a broadcast protocol, it's not
> connection oriented.
>
> Regarding the maximum number of bytes per transfer in read() or
> write(): I don't know of any general limitation except the range of
> valid numbers in size_t; but of course there may be implementation
> specific limitations.
> In general I would suggest not to use more than a few MB per single
> transfer; chances are too high that a short network dropout will kill
> the packet.
>
> Regards,
> Nico
>
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/