Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi guys,

I need to write a program which sends stock market data at real time. I get data on a local pc running windows. I have to transmit that data to my linux webserver (which supports mysql & php). So that my front end app can get that data.

Local PC running windows -----> Linux web server <-----> app in user's pc

My app can request data like I want for this company and x amount of data. And the server should send that data.

In order to achieve the goal, what should I do?

Help will be appreciated.



1 solution

This is quite possible, but to make it really easy I would suggest you use Mono on Linux ([^]).

You can do it without Mono, of course, but will spend considerable amount of time for mapping all data types, set aside possibility to do remoting. With Mono, you can share any part of you code between Windows and Linux. Projects developed on Windows will run on Linux without re-compilation (if you use standard set of libraries plus a lot of non-standard but compatible, even System.Windows.Forms). I know because I run my Windows .NET applications on Linux.

My instructions I posted in response to other Question on networking will also apply. Please see: Multple clients from same port Number[^].

(As a side dish, please see a collection of my advices on threading which are helpful on both server and client sides): How to get a keydown event to operate on a different thread in[^]. Please ignore the fact that those directions are related to some very different applications — most of them are quite applicable to your situations.

Good luck,
Share this answer
Sandeep Mewara 12-Mar-11 1:51am    
Comment from OP:
Hi SAKryukov,

Thanks for your help. I appreciate it.

Actually if you can provide a solution for my scenario, I would be very grateful. I am a lone developer and currently struggling to solve a problem.

My task: I get stock market data, real time, that is every second. That data contains prices of a few hundred companies or a little more. Now the data comes to my local pc running Windows. I need to figure out a way to send that data so that my users who are using my program can get it at real time. Which means that if they request for google, then first they should get past data for google and then every second they should get current prices.

Now my linux web server comes in between because thats is on the internet and accessible by my program. So I need to figure out a way so that data can be transferred from my system to my linux server, it can be stored there, and from there to my .net app. My .net app should be able to pass requests such as data for what company and dates etc. All this should take place with minimum lag.

In order to fulfill this what should I do ? Any help will be really appreciated.


Sergey Alexandrovich Kryukov 12-Mar-11 17:36pm    
It sounds like you do polling which is the only way to get data, due to the nature of the data source. You should not reproduce this situation in your service for all clients. It means that you should implement publisher-subscriber. When you client connects, you include it in the set of your client and push fresh data to all of them. It's important to have timeout in client application protocol, otherwise each client will delay others. On timeout you will disconnect a client from your side, so the client should either go or reconnect. You should push data only of data after next polling side is really updated (so you remember current state of data). This way, you will get less sendings compared to the case of client-server polling.
jackgreat 16-Mar-11 9:25am    
How should I go about it ? Can you specify technologies I need to use & how.
Sergey Alexandrovich Kryukov 16-Mar-11 16:29pm    
Use my reference I post in my answer to get an idea. That my post is almost an article. If something is not clear, ask a follow-up Questions. With Mono, it will be exactly the same, only there is no Window Service on Linux. Probably you have to read one Linux daemons and related stuff (after all, it could be a regular application).
Sandeep Mewara 12-Mar-11 1:52am    
Good answer. 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900