Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
As a speed issue, you should definitely consider a better form of IPC. You say that you fork off the server and clienst, this will probably mean that they're on the same computer ;so using a TCP socket is a real waste of time and complicates things unnecessarily. You guys are even giving him advice against a local domain socket (UNIX domain socket) which will speed up the communication by at least a factor of 6! Of course, the fastest IPC is shared memory created by memory mapping a file (mmap). But judging by your current design, you should go for semaphores in shared memory or the current library that provides system-wide semaphores (which will take care of the mmap). On POSIX systems, this will be <semaphore.h> and perl supports only SysV sems via IPC::Semaphore (for those crappy and bulky SysV semaphores) or you can try the Thread::Semaphore which does not require you to have any more than one thread and simplifies things quite a bit though it does not provide system-wide sems. Just remember to make them systemwide for your multiple processes (which on POSIX systems will become a path and on SysV an IPC object viewable with -wow- ipcs at the command line! Remember, THERE IS NO REASON TO USE SOCKETS ON THE SAME COMPUTTER (sic). (Exception: generic client not optimzed for use on same computer, only multiple computers which is the way most games are setup so it's not waiting on I/O on a socket and some other IPC.) If you really want to get intense, you'll check out IPC::Msg which is probably more than you need for this simple client/server arrangement. (Most systems provide also for system-wide pipes called FIFOs.)
I see this only all too often. A lack of POSIX functions forces me to revert to C/C++. O, shame! Perhaps I'll extend the POSIX library which is very poorly arranged indeed!
AgentM Systems or Nasca Enterprises is not responsible for the comments made by AgentM- anywhere.

In reply to Re: Socket programming by AgentM
in thread Socket programming by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found