× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Buck wrote:
>I'm working with sockets and have a mental block.
>...
>  Is it time to abandon the idea of
>multiple clients here and go with a simple "listener/talker" that sends
>requests to a spawned client server?  Do all the "long" work
asynchronously
>and have the socket program handle communications chores only?  How do I
>handle atomic operations like a login sequence that need to run in order?
>
>Ow, my head hurts.

You might find it easier to program what you want in C.  Normally,
for such TCP server apps, when a client connects to the server,
the client spawns off a thread to process the requests from that
one client.  In the meantime, the server thread loops around to
wait for new clients.  (There are plenty of examples of TCP server
coding in C on the internet.  Just use your favorite search tool.)

RPG has poor support for threads, and so C is the better choice.
Your C program could still call RPG procedures in modules defined
with the THREAD(*SERIALIZE) options.  But that option serializes
calls to the module, and client threads may still block waiting
for the module to be available.

Another option is to service requests using the HTTP server.
You'll still have to manage state information yourself somehow,
but all the multi-threading details can be handled by the HTTP
server.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.