|
You'll could wrap the data that the IC sends to Comp1 with data describing where to send the response. Then the sequence of events can go like this:
* IC sends data to comp2
* comp2 wraps it with a header including information about who sent it
* comp2 forwards it to comp1
* comp1 generates a response that includes the header information
* comp1 sends the response back to comp2
* comp2 reads the header and forwards the response back to the original sender
or if comp2 can access the public internet then it can read the header and send the response directly. Doing this with TCP is pretty similar, just look up the TcpListener and TcpClient classes.
Boss5 wrote: while (true) { };
ew. Something like this might be better implemented as a service rather than a console app.
|
|
|
|
|
I thought about that, but the Server application is not mine, so I cannot modify it and implement header reading. Server decides the "source" of packet by UDP's IEP.
|
|
|
|
|
well then, the forwarder could keep a queue of sender information; when the forwarder receives something from an IC it queues the info and when it receives something from the server it can pop off the oldest info and forward the response. Of course you'd need to use a separate socket and port number to send data between the forwarder and server to keep the two data channels separate. That should work as long as each message received from an IC generates a response from the server and the server issues responses in the same order as it receives commands. If that isn't the case then the maybe the forwarder could use some smarts to only keep sender info for messages that will generates responses from the server.
Outside of that I'm not sure what to suggest. There might exist a hardware solution as you suggested in you original post but that's outside my area of expertise.
|
|
|
|
|
I tried that way too actually, but the problem is that there are, in fact, 4 ICs and the data is being sent at a pretty high rate, so responses become totally chaotic.
I have been trying to solve this for a week already and I would actually give up considering the task impossible, but there ARE actually port forwarders like AUTAPF, which succesfully forward all the data and return proper responses to proper places. Though the devs will not likely tell how they do it.
|
|
|
|
|
can i get a sample code for this port forwarding in linux C
Thanks
Sathish
|
|
|
|
|
No, for a couple of reasons:
1) this is the wrong forum to ask, there's a Linux forum and a C/C++ forum where this would be more appropriate
2) I don't have an example handy and
3) I don't have time to make one
You could try asking in one of the other forums but even then I'm not sure anyone would have a complete example handy for you. The articles on CP or Google may be your best bet.
Sorry.
|
|
|
|
|
Hi all!
I'm trying to build an MDI application with a fixed position left sidebar. On the right side I'd like to open other windows.
This is my problem.
When I open a child form, if I maximize it the form extends even under the side bar. The sidebar is now implemented with a panel anchored on top and bottom of the MDI main form (already set as an MDI container). The panel contains inside a treeview which links are used to open different child windows.
How can I make the sidebar panel a constrain for the MDI main form? So when I maximize a child form I can avoid child forms open partially behind the panel.
For those who know, as an example think about the layout of Oracle SQL Developer interface. The sidebar contains connections to databases and I've to do the same thing!
modified on Monday, November 2, 2009 10:41 AM
|
|
|
|
|
I have done this by using the following steps:
1) Start new Window Forms Project. Rename Form to MainForm, just so we both know what I'm referring to. You can just remember this bit if you have more than 2 brain cells.
2) Add ChildForm to Project.
3) Add Menu to MainForm, with MenuItems for adding child forms. Complete the event handlers.
4) Now add your Panel to MainForm and Dock as required.
5) NOW!! set IsMDIContainer to true for MainForm.
Works for me! Hope it helps you.
[Edit]
I have just realized that the above is complete rubbish. Oh it works, but the order is irrelevant.
I have just created a new application in which I set IsMDIContainer before doing anything else, it still worked,
So I don't know what is going wrong with your application.
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Hi all,
I'm new to c# and I'm wondering how to access the sound card from my code so that I can sample the sound.
Thanks in advance
Darren
|
|
|
|
|
If I have a multi-thread program, how can I know on which core
each thread run ?
Thanks..
--
Evyatar
|
|
|
|
|
Are you really using Multicore ??
The thread can only use Multi cores if its run using Parallel Extension. Its there if you add the Threading.dll that comes with the extension pack.
Otherwise, the process can run in a single core.
|
|
|
|
|
That isn't even true. Why do you think it is?
|
|
|
|
|
Then what does Parallel extension do ?
Tricky Programming on Multi-Core Processors[^]
You can see, threads running concurrently in more than one core if Parallel extension is used. Does this work with normal threads as well ?
If this is so, then I wonder what are the advantages of Parallel Extension ever.. And also why one would ever use an object of Task .
|
|
|
|
|
The parallel extensions have task stealing and convenient constructs such as Parallel.For
The parallel extensions can use multiple cores because they use threads
|
|
|
|
|
Thank you so much.
|
|
|
|
|
Hi,
AFAIK you can't. Threads can run on any available core, and they are not restricted to a single core, so they may hop over to another one after a thread switch. You can reduce that freedom by setting ThreadAffinity/ProcessorAfinity but you really have to know your stuff to take advantage of that.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
On Vista or higher there is a new function called
GetCurrentProcessorNumber. I think thats exactly what you are looking for.
Greetings
Covean
|
|
|
|
|
Right. The Win32 functions GetCurrentProcessorNumber and GetCurrentProcessorNumberEx are available through P/Invoke since Vista/Win7 respectively.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
What about NTGetCurrentProcessorNumber ? Seems to be available on older OS's
[DllImport("ntdll"), SuppressUnmanagedCodeSecurity]
public static extern int NtGetCurrentProcessorNumber();
|
|
|
|
|
The doc says: "NtGetCurrentProcessorNumber may be altered or unavailable in future versions of Windows. Applications should use the GetCurrentProcessorNumber function instead."
It is available on my Vista system; don't know about Win7.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
|
I want to measure core thruput on variety of programs.
|
|
|
|
|
Thanks all ..
I will go t check your answers and will come to give feedback...
|
|
|
|
|
Hi all ..
The GetCurrentProcessorNumber() work wonderful ..
so thanks to all the helpers
|
|
|
|