Verilog PLI website 
Author Message
 Verilog PLI website

   Project VeriPage: http://www.*-*-*.com/

   I. What's new ?

   1. Couple of new examples have been added to the
   Free Examples section.
   2. The front page has got a face lift.
   3. A sitemap has been added for easy surfing.

   II. About Project VeriPage:

   This is a free informative site on Verilog PLI
   with a growing number of articles on Verilog in
   general. Although there are few sites available for
   Verilog related information, this is the only site
   in my knowledge, which has been focussed on Verilog
   PLI. It has a number of resources on the subject
   including a FAQ, a tutorial and several examples
   on Verilog PLI. If you are a novice, take a look
   if it can help you in breaking the ice; if you are
   a guru, stop by and impart your knowledge to others.

--
=-=-=-=-=-= 100% pure Verilog PLI - go, get it ! =-=-=-=-=-=
     Principles of Verilog PLI -By- Swapnajit Mittra
     Kluwer Academic Publishers. ISBN: 0-7923-8477-6
      http://www.*-*-*.com/

--== Sent via Deja.com http://www.*-*-*.com/
---Share what you know. Learn what you don't.---



Thu, 01 Nov 2001 03:00:00 GMT  
 Verilog PLI website


Quote:
> =-=-=-=-=-= 100% pure Verilog PLI - go, get it ! =-=-=-=-=-=
>      Principles of Verilog PLI -By- Swapnajit Mittra
>      Kluwer Academic Publishers. ISBN: 0-7923-8477-6
>      http://www.angelfire.com/ca/verilog/

> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---

Swapnajit,

I finally got the book above. Congratulations.
The section about inter-process communications was very helpful.
Regarding this issue, I need an advice on the following :
The 'accept' call of the server is blocking by default. It will not
return until a connection is available. I know that it is possible to
define the socket as non-blocking. Can you advise me how? Actually I
want to achieve the effect of the server 'visiting' the socket and if
there is no connection of the client to let it continue.
Thank you,
     Andi Carmon

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sat, 17 Nov 2001 03:00:00 GMT  
 Verilog PLI website

Quote:

> Swapnajit,

> I finally got the book above. Congratulations.
> The section about inter-process communications was very helpful.
> Regarding this issue, I need an advice on the following :
> The 'accept' call of the server is blocking by default. It will not
> return until a connection is available. I know that it is possible to
> define the socket as non-blocking. Can you advise me how? Actually I
> want to achieve the effect of the server 'visiting' the socket and if
> there is no connection of the client to let it continue.
> Thank you,
>      Andi Carmon


   Andi,

   I am glad that the example in the book
   has encouraged you to do further research
   on the topic; after all, that is one of the
   main objective of the book.

   Regarding your question, you can create a
   non-blocking socket (by default, all sockets
   are blocking) by using fcntl() system call.
   An example of this is :

   fcntl(s, F_SETFL, FNONBLK);

   where s is the socket created by socket().
   The names of the integer constants may be
   slightly different depending on your version of
   UNIX. For example, when FNONBLK is POSIX
   compliant, IRIX uses a native FNONBLOCK.

   Also, there are other ways to do the same. Some
   flavors of UNIX (and BeOS) does this using
   setsockopt(), but it is not implemented
   in all OS'.

   Thanks,
   - Swapnajit Mittra
--
=-=-=-=-=-= 100% pure Verilog PLI - go, get it ! =-=-=-=-=-=
     Principles of Verilog PLI -By- Swapnajit Mittra
     Kluwer Academic Publishers. ISBN: 0-7923-8477-6
     http://www.angelfire.com/ca/verilog/

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Mon, 19 Nov 2001 03:00:00 GMT  
 Verilog PLI website

Quote:

> Regarding this issue, I need an advice on the following :
> The 'accept' call of the server is blocking by default. It will not
> return until a connection is available. I know that it is possible to
> define the socket as non-blocking. Can you advise me how? Actually I
> want to achieve the effect of the server 'visiting' the socket and if
> there is no connection of the client to let it continue.

Andi,

  You didn't mention what platform/OS you're running on, but in general
there are two ways to approach this:

  (1) you can issue an fcntl() on the socket file descriptor (i.e. the
fd you
        got from socket()). You'll probably want to do a F_SETFL with
O_NDELAY
        or O_NONBLOCK. Check the docs for your platform.
or
  (2) you can "poll" the fd using poll() or select() (which one depends
on your
        platform). You'll want to check for read availability (i.e. if
the call says
        the fd is ready for read operations, you can then do an accept
on it and it
        won't block).

  Hope this helps,

  --Bob

--
Bob Beckwith
To reply, remove NOSPAM. from the email address above.



Mon, 19 Nov 2001 03:00:00 GMT  
 Verilog PLI website


Quote:


> > Swapnajit,

> > I finally got the book above. Congratulations.
> > The section about inter-process communications was very helpful.
> > Regarding this issue, I need an advice on the following :
> > The 'accept' call of the server is blocking by default. It will not
> > return until a connection is available. I know that it is possible
to
> > define the socket as non-blocking. Can you advise me how? Actually I
> > want to achieve the effect of the server 'visiting' the socket and
if
> > there is no connection of the client to let it continue.
> > Thank you,
> >      Andi Carmon

>    Andi,

>    I am glad that the example in the book
>    has encouraged you to do further research
>    on the topic; after all, that is one of the
>    main objective of the book.

>    Regarding your question, you can create a
>    non-blocking socket (by default, all sockets
>    are blocking) by using fcntl() system call.
>    An example of this is :

>    fcntl(s, F_SETFL, FNONBLK);

>    where s is the socket created by socket().
>    The names of the integer constants may be
>    slightly different depending on your version of
>    UNIX. For example, when FNONBLK is POSIX
>    compliant, IRIX uses a native FNONBLOCK.

>    Also, there are other ways to do the same. Some
>    flavors of UNIX (and BeOS) does this using
>    setsockopt(), but it is not implemented
>    in all OS'.

>    Thanks,
>    - Swapnajit Mittra
> --
> =-=-=-=-=-= 100% pure Verilog PLI - go, get it ! =-=-=-=-=-=
>      Principles of Verilog PLI -By- Swapnajit Mittra
>      Kluwer Academic Publishers. ISBN: 0-7923-8477-6
>      http://www.angelfire.com/ca/verilog/

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Swapnajit,
Thank you for the tip. I think I need only one small additional push.
I defined the server socket as non-blocking (but not the client).
The accept() call is now part of the read_server routine and to check
for availability of new data from client I use poll() as Bob Beckwith
also suggested. The problem is that the ping-pong works only once!
It seems that I need some means to "re-arm" the mechanism.
The sequence I get is as follows: (As I mentioned the server is
triggered in verilog and checks for availability of new data from
client).
client_write; client_read (now waits for server_write).
Later, the server check and successfully detects the pending data.
server_write; client successfully detects server_write and performs
again
client_write; client_read (now waits for server_write).
Now, here is hangs up.
The server, triggered later again, checks but does not detect any more
pending data.
Can you see what the problem is ?
Thank you again, and if you attend DAC I would like to thank you
personally.
Andi Carmon

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Fri, 23 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Verilog PLI website

2. Verilog PLI website

3. Verilog PLI website

4. Verilog PLI website

5. Verilog PLI website

6. Verilog PLI website

7. Verilog PLI website

8. Verilog PLI website

9. Verilog PLI website

10. Verilog PLI website

11. Verilog PLI website

12. Verilog PLI website

 

 
Powered by phpBB® Forum Software