答复: When the keep-alive packet sent out,rfc1002 says different things!!

Aladdin_Cai at asus.com.cn Aladdin_Cai at asus.com.cn
Tue Apr 1 01:40:06 GMT 2003


Thank you all.
For the case 1.there will be many echo overhead.And I have no way to know the server timeout when I am in client, so I can't determinate when to send echo packet.

For case 2, I have though over it. suppose there is such a situation:
     when I WriteRaw data to server and server will send me a "writeRaw OK" response.And almost the same time,keep-alive is sent.Now I take the stuff out from socket buffer, which is a mixture of "writeRaw OK" and keep-alive packet. And it is worse when it happens during the ReadRaw, as you know, the data in the ReadRaw has no protocol header, when a keep-alive packet is inserted into the stream, or  if the raw data might be also something like {0x85 0 0 0},simply discarding will do the wrong thing. (although the possibility is very low.)


-----原始邮件-----
发件人: Christopher R. Hertel [mailto:crh at ubiqx.mn.org]
发送时间: 2003年4月1日 2:07
收件人: Andrew Bartlett
抄送: Aladdin Cai(絆價_豎奻漆ㄘ; samba-technical at lists.samba.org
主题: Re: When the keep-alive packet sent out,rfc1002 says different things!!


On Mon, Mar 31, 2003 at 08:07:16PM +1000, Andrew Bartlett wrote:
> On Mon, 2003-03-31 at 19:42, Aladdin_Cai at asus.com.cn wrote:
> > Hello everyone, When I am programming a samba client in freeDOS,using
> > wattcp, I found a strange thing, which is not the same as rfc1002 claims.
> > In rfc 1002,see below:
> 
> > So,during I write data or read data to server, it seems that server will 
> > not send me any keep-alive packet because he will reset the timer.But
> > in fact,during I raw write a very large piece data to server(not
> > matter windows or linux),it will send me a keep-alive
> > occasionally,leading my defendless code crash.
> > I REALLY don't understand why they don't obey the rules, or do I 
> > mistake rfc1002?
> >  
> > Urgently hope for your kindly help,thank you!!!!
> 
> See www.ubiqx.org/cifs for a description of this horrid protocol...
> 
> Also, make sure you understand - the standard is what Microsoft does,
> not what what any RFC says.

Also note that you may have trouble with ReadRaw and WriteRaw.  Microsoft
published documentation regarding these SMBs a long time ago and never
suggested that there might be licensing issues.  Just about a year ago,
however, they coughed up some patents which may or may not apply to
implementations of ReadRaw and WriteRaw.  See:  
http://us3.samba.org/samba/ms_license.html

That said, the problem you are experiencing, if I understand correctly, is 
that the server is sending keep-alives during a WriteRaw from your client 
because the server-side keep-alive timer is not reset.
Two solutions:
1) Send an SMB ECHO just before doing the WriteRaw.  That will reset the
   timer.
2) Handle the keep-alive.

For case #2, the keep-alive will contain the bytes { 0x85, 0, 0, 0 } and 
that's it.  You should be able to recognize those and simply discard them.

Chris -)-----

-- 
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list