Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
Hi,

i am trying to realize some kind of an information system.
The system should work like that:
.Net Program provides Data via a Tcp Server,
Browser clients should connect to server and display the incoming data.
I guess the only way i can do that is via javascript.
Does anyone of you have experience with such things, or can give me advice,
which components i can use for this?

Kind regards
Manuel
Posted
Comments
Sergey Alexandrovich Kryukov 2-Oct-12 14:21pm    
What, no server-side technology available? No ASP.NET, not even PHP, for the low-end? (PHP is seemingly available everywhere :-) Doing it on the client side is not beneficial, can be very unsafe, etc.
And now, about the TCP/IP server? What is that, again, fully proprietary application layer? No standard application-level protocol? This also could be a problem.
--SA
m.bleimuth 2-Oct-12 14:32pm    
Yes php is available, so you mean i should implement the tcp client in php and connect it to my .net tcpserver. Then i can send the data via ajax to my webpage without reloading?
Sergey Alexandrovich Kryukov 2-Oct-12 15:17pm    
Apparently, you can. The Ajax would just provide the event and pass user data needed for TCP communication, and PHP will generate HTTP response you can use in JavaScript. This way, JavaScript won't directly deal with network. It would create more of the loose binding type of architecture, make the application more modular, improve the possibility for unit testing, so development can be done more smoothly, and results could be more reliable. Using custom (I mean it, custom! something as you have) networking directly with JavaScript is pretty rare, I think.
--SA
m.bleimuth 24-Oct-12 4:57am    
If i do it with php, i cannot realize if a new client has connected to my System, or wich client has connected? I want be able to send data to specific clients. If i would program the client in .Net i have a socket to each client. Is there absolutly no way of implementing multiple socket connections to each browser client, I know i could do such things with flash or silverlight, but i want do it without any client plugin.

Manuel

1 solution

Please consider my comments to the question as a big warning against this approach.

If you still want to use it, please see:
http://code.google.com/p/jsocket/[^],
http://socket.io/[^].

Try to find some more:
http://bit.ly/VpKzi9[^].

[EDIT: in response to PHP-related discussion in comments:]

This is how you can do it in PHP. For server side, with PHP in particular, custom networking is way more usual, by the reasons I tried to explain in comments to the question (please see the on on PHP) and this answer:
http://php.net/manual/en/ref.sockets.php[^].

—SA
 
Share this answer
 
v3
Comments
m.bleimuth 2-Oct-12 14:44pm    
Thanks for your comments, i guess for my Project security does not matter, because the clients will only run in a local network without internet connection and only for a few hours a day. There is no need to keep the server and client available everytime.
Sergey Alexandrovich Kryukov 2-Oct-12 15:13pm    
Well, if the solutions exist, somebody use them, and it might be even reasonable. So, your case could be one of them.
Still, considering PHP (I refer to your comment where you answered that it's available to you) should be seriously considered as a more reliable option, even if the security is not a concern. Just reliability.
--SA
Sergey Alexandrovich Kryukov 2-Oct-12 15:22pm    
I added the reference, after [EDIT] and one more comment to the question (about PHP and Ajax).
Please seriously consider doing your custom networking on the server side.

As you got pretty detailed review of available options, will you consider accepting the answer formally (green button)?
--SA

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