mattbauer Posted June 6, 2007 Report Posted June 6, 2007 Hello. Below, is a sample of code that I am using to get data from a particular offset using FSUIPC3x and FS9. 1) What happens when FSUIPC opens a connection? fsuipc.FSUIPC_Initialization(); result = fsuipc.FSUIPC_Open(dwFSReq, ref dwResult); result = fsuipc.FSUIPC_Read(dwOffset, dwSize, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref dwResult); fsuipc.FSUIPC_Close(); 2) How long does the sequence from 'Initialization' to 'Close' take? 3) Is a unique connection opened for each FSUIPC_Open? 4) What happens when ten connections to FSUIPC are opened but never closed until the SIM powers down. 5) Is there a recommended strategy for handling many connections to FSUIPC? Thankyou for your time, -Matt B.
Pete Dowson Posted June 6, 2007 Report Posted June 6, 2007 Below, is a sample of code that I am using to get data from a particular offset using FSUIPC3x and FS9. Actually the interface is independent of FSUIPC version or FS version. In fact it is the same as in FS6IPC days, before FSUIPC. 1) What happens when FSUIPC opens a connection? FSUIPC doesn't open a connection, your program does, via FSUIPC_Open. All that does really is create the memory-mapped file which will be used to exchange data, and get the FS and FSUIPC version numbers for you. The full source of all the application-side interface is supplied in the SDK, so you can review it yourself. fsuipc.FSUIPC_Initialization();result = fsuipc.FSUIPC_Open(dwFSReq, ref dwResult); result = fsuipc.FSUIPC_Read(dwOffset, dwSize, ref token, ref dwResult); result = fsuipc.FSUIPC_Process(ref dwResult); result = fsuipc.FSUIPC_Get(ref token, ref dwResult); fsuipc.FSUIPC_Close(); That's not my language, but I assume you only ever want that one Read and nothing else from FSUIPC in the session? Normally you'd Open at the start and Close when your program has finished. And you'd accumulate all the Reads and Writes you needed, per cycle, for one Process, at intervals appropriate to your application. 2) How long does the sequence from 'Initialization' to 'Close' take? Forgetting the Open, because you only ever do that once, the only part of that which leaves your program is the Process call. That Sends a Message via Windows and waits for a response. How long that takes is completely up to Windows, the loading on the system, the state of FS at the time, and, of course, whether you are running on a WideFS client or on the FS PC. 3) Is a unique connection opened for each FSUIPC_Open? The only thing you could think of as a "connection" is the memory-mapped file the Open creates (and the Close destroys). That is unique to that Open (and that process). FSUIPC itself doesn't keep track of any of them. All requests are treated equally. 4) What happens when ten connections to FSUIPC are opened but never closed until the SIM powers down. Ten "connections" from ten programs, you mean? Since the "connections" are merely memory-mapped files created by and owned by the programs, if they are never closed they stay open, using virtual memory. If the program closes I presume Windows might tidy that up, but if not you have a memory leak and if you continue like that forever you will fill the swap file space. All that is irrelevant to whether FS continues to run or is closed, as it (and FSUIPC) knows nothing about the memory-mapped file -- as far as it is concerned it is just used during the Process call, to get data from or put data in, and then forgotten. 5) Is there a recommended strategy for handling many connections to FSUIPC? From many programs? No. there is no need. As far as FSUIPC is concerned, 100 programs "connecting" and asking for data once a second each is the same as one program "connecting" and asking for data 100 times a second. All you should have to worry about is how to get those 100 programs all running smoothly under windows without severely reducing FS's own performance. That wouldn't be a concern on a WideFS client of course. If you are really talking about one program with multiple "connections", don't try it. To do so in any case you'd have to write your own interface code, or each "connection" could have problems with the generated memory-mapped filename. In one program you only need to Open at the start and Close at the end. One memory-mapped file per process. Regards Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now