I was wondering if it's possible to create an application in C# to streaming video to a php client. Someone out there have already try such thing or can indicate where to find resources to do that?
What do you mean by a PHP client?
Last time I checked, PHP was a PURE server side technology, and the "client" is a web browser that does not care about what the server uses but interprets the PHP output which are essentially strings in HTML and JavaScript.
So, what you want to achieve having a video decoded on the server? Send them as JPG images to the client?
You just take the reference of this link. You will get the idea to resolve your problem.
UDP Streaming transfer from C# application to PHP webpage
Related
I want to make a program in either C# or Java that can read all of the network data sent to another program I have open. I want to then save this in a log file. Can anyone give me some suggestions as to how I can achieve this? (I would prefer to use C#)
You can create an Http Proxy to capture the network traffic (assuming it's http), just as the popular tool Fiddler does. Take a look here: Any resource/codes on how fiddler works?
I've got a SSL connection working with my website alongside PHP sessions. I have created my own connection class to provide a single sign on, allowing my user to then interface with php script outputs from my website. I have a question though, currently I use my PHP scripts which query the database and formats the data into a HTML page, which my program then reads over the SSL connection. My program has to parse the data which may be slow for large data volumes. My question is:
without having to radically change my system architecture, is there a way to make passing the data between the server and the C# application more efficient. Currently I'm using string delimiter parsing to extract data in a way similar to command seperated values (CSR).
I've heard the word JSON passed around alot, but I think I might as well use XML instead.
SERVER: MySQL, PHP, APACHE
Thanks
Thomas
What you want to research is c# web applications and a SOA architecture. JSON or SOAP will be the transfer protocol on which your PHP will talk to your C#. What you will need to do if you decide to use soap is make a c# web service as an endpoint between your PHP and your database and the c# will talk to the DB and pass the data to the PHP. you may want to look into caching as well but that's only if you need scalablity. One thing that is nice about PHP 5 is that it has a built in method to talk to the soap protocal which just turns it into an array of values passed from your C# it makes it very easy to do. What your going to need to happen with your PHP is you will need to replace the SQL querys with SOAP connections. One more thing to consider is a WCF service because webservices have been "deprecated" in anything above .net 3.5. Hopefully it shouldn't be too painful
http://php.net/manual/en/class.soapclient.php
Scroll down a little on this page it has some good examples for your calls.
JSON is suppose to be a quicker protocol then SOAP I just do not have alot of experience with it myself.
Handling data in a PHP JSON Object
SOA the main concept apply to c# as well
http://www.javaworld.com/javaworld/jw-06-2005/jw-0613-soa.html
I am not 100% sure about c# and mysql connections I am sure there is stuff out there for it. I think the biggest problem you may have is hosting a C# service on an apache server.
Maybe check into using JAVA web services, I know it works well with apache and mysql and is used by alot of major websites.
I'm currently writing an http server in C# and I'm planning on allowing it to use PHP. How does PHP work? Like, the compiler or whatever it uses. I was thinking it takes php files in input and outputs the html or whatever file for the http server to give to the user's request. Is it possible to call on the php compiler or whatever with the file requested by the user? Please tell me if I'm thinking about this the wrong way.
Thanks
There are a couple ways to interact with PHP. The easiest way to get started is to implement CGI in your program.
Wikipedia has a nice example.
Basically, you execute PHP-CGI.exe, and send/receive data over standard in/out.
I'm working on a project that has a C# app (running 24/7 as a server) on the client's machine). This app needs to send a file as a byte stream via POST to a server I am currently hosting on my home desktop.
Can this file be received by a C# app running on my server, or does it have to be as ASP app/page?
Also, I know how to send a bytestream via POST, but how will I set my server side app to listen for this incoming data?
I have never done something like this, so I'm looking for some pointers to get me started.
Thanks
Depending on what you need to do with the file, and when it's uploaded, there is nothing wrong with using a tiny asp.net app to do this.
If the only way you can get the file to the server is via http POST, why write your own service/daemon to run a listener? Unless you have some reason not to run it in IIS, I would do it there. There is the full stack available that way for authentication and so on if you should happen to need it. Besides, if you have to upload files via http post, I would bet you will end up wanting other methods available via HTTP as well..
You're looking for this guy:
http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
Using that, you'll create basically a mini HTTP server, listening on some port you specify. You'll then be able to post data to it, and process it accordingly (similar to if the processing code was in an ASPX code-behind).
Assuming your open to sending directly via TCP you can look at this example if you dont wanna go the HTTP way. I personaly like the NetworkStream Class, for sending data over the network painfree.
I'm wondering if theres already a combo let say jQuery - Some C# DLL to proive a secure both way communication between ASPX forms with jQuery and a control layer based on ashx files with C# classes...
[From comment below]
Well I see I have to be more specific. The are things like sniffers on simple network analysis tools even like Firebug that let you see the data transfered via POST or GET. The idea to secure a Server Client application is to ensure that data isn't corrupt and compromised, and to achive that you have to make imposible to an atacker to report false info so the best is to have improved some cryptographyc algorithms both on client and server to crypt decrypt encode decode data...
The only way you can ever make web communication secure between a client and a server is by using SSL.
Here is a Javascript AES engine.
However, you really should use SSL instead.