1995-07-21 - Re: Problem synchronizing sockets…

Header Data

From: rross@sci.dixie.edu (Russell Ross)
To: Andre Turgeon <andre@oscar.cs.byu.edu>
Message Hash: d8082e8fd27154c25dc2f7e2396e7f777a3a00dca15a000497bd7faffabdaca7
Message ID: <v01520d00ac35d2195066@[144.38.16.209]>
Reply To: N/A
UTC Datetime: 1995-07-21 21:48:59 UTC
Raw Date: Fri, 21 Jul 95 14:48:59 PDT

Raw message

From: rross@sci.dixie.edu (Russell Ross)
Date: Fri, 21 Jul 95 14:48:59 PDT
To: Andre Turgeon <andre@oscar.cs.byu.edu>
Subject: Re: Problem synchronizing sockets...
Message-ID: <v01520d00ac35d2195066@[144.38.16.209]>
MIME-Version: 1.0
Content-Type: text/plain


>        I'm a newbie at socket programming so this is probably going to
>be an easy question (I hope). I've been developing a client/server
>project using SSLeay and I'm having problem synchronizing my messages.
>More specifically, I use a combination of SSL_read and SSL_write to
>exchange messages bix my client and server. The problem is that my
>client is reading (SSL_read) before the server is done writing and reads
>an empty buffer. This does not occur all the time but often enough to
>make things quite unreliable... I've tryed using the select() command
>but that doesn't solve it. Help.....
>
>        Andre

This is generally true of sockets programming.  You don't know that you'll get
as many bytes as you request.  The simplest solution is to loop your read
calls until you get what you need.  See BSD Sockets: A Quick & Dirty Primer
for a sample solution.  The URL is http://www.ntua.gr/unix/sockets.html

-----------------------------------------------------------
Russell Ross                     email: rross@sci.dixie.edu
1260 N 1280 W                    voice: (801)628-8146
St. George, UT 84770-4953







Thread