<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.3790.2817" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>This is expected pipe behavior (to 
split/concatenate writes following its internal rules).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>As a workaround, you can perform quick lookup 
through message to calculate its real size (especially if you have Q.921 
headers).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>WBR,</FONT></DIV>
<DIV><FONT face=Arial size=2>Paul.</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=paulo.astdev@gmail.com href="mailto:paulo.astdev@gmail.com">Paulo 
  Garcia</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A 
  title=asterisk-dev@lists.digium.com 
  href="mailto:asterisk-dev@lists.digium.com">Asterisk Developers Mailing 
  List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, February 07, 2007 10:30 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [asterisk-dev] Implementation 
  using libpri and socketpair()</DIV>
  <DIV><BR></DIV>Hi,<BR><BR>in my own channel, I'm implementing ISDN support 
  using Libpri. The implementation is completely independent from zaptel then 
  I'm trying to do all communications between my hardware and libpri using 
  socketpair function. <BR><BR>The idea is to create a socketpair, passing fd[0] 
  to pri_new function and writing to fd[1] to pass data to libpri. So far so 
  good...<BR><BR>To receive data from libpri, I have a thread checking for all 
  file descriptors fd[1] using select() function and when I receive something, I 
  pass it to my card. This approach also works well but sometimes I receive two 
  messages (from libpri) in only one read() call. I think this is because of 
  libpri writes two messages so fast then when the read is called, there are 
  already two messages in socket buffer... <BR><BR>How can I avoid this 
  behavior? Maybe using another way different of socketpair ? This communication 
  will be used only inside the same process, between different 
  threads.<BR><BR>Any path or idea will be appreciated. 
  <BR><BR><BR>Regards<BR><BR><BR>Paulo Garcia<BR>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>--Bandwidth and 
  Colocation provided by Easynews.com --<BR><BR>asterisk-dev mailing list<BR>To 
  UNSUBSCRIBE or update options visit:<BR>&nbsp;&nbsp; 
  http://lists.digium.com/mailman/listinfo/asterisk-dev<BR></BLOCKQUOTE></BODY></HTML>