Solved

WinInet to communicate with Web Server for real time media streams

Posted on 2009-05-08
5
278 Views
Last Modified: 2013-12-03
Hi Experts,

I need some advices on using WinInet to establish HTTP connection with a web server synchornously/ asynchronously to send CGI Command for real time media stream transfer.
Basically the flow is as follow:
1. Client application connects to web server (with HTTP Basic Authentication).
2. Client sends CGI command to the web server using HTTP/1.0.  (If using WebBrowser2 Object, it will be webBrowser.Navigate(_T("http://127.0.0.1:8080/CGI_Commands..."));  how should I do this if I want to use WinInet instead of WebBrowser object)
3. The web server will reply with the media stream info embeded in the HTTP /1.0 200 OK response.
4. End connection.

Some brief step-by-step procedure using the WinInet API (Sequence and API to be used for each step as described above) will be enough for the work.  Appreciate if there are some advices in choosing Synchornous/ Asynchronous connection for the task.

For your information, I'm using Visual C++ 2005 and pure Win32 Programming to create a DLL components for doing this task.

Thank you!
0
Comment
Question by:cskiong
  • 3
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
ID: 24346111
This codeguru article shows the basic steps:
    Get web page using WinInet class wrapper
    http://codeguru.earthweb.com/cpp/i-n/internet/generalinternet/article.php/c3411/

InternetOpen
InternetOpenUrl
InternetReadFile
0
 

Author Comment

by:cskiong
ID: 24348365
Hi DanRollins,

Thanks for the web reference.  The web page gives me something to start from.
I think I would need to use the WinInet to work in asynchornous mode, as I need to send CGI commands to the web server while the web server keeps sending my application some real time multi-media streams.

I have found one website: http://www.codeproject.com/KB/IP/asyncwininet.aspx
However I'm still digging my head and feel a bit lost.  Some advices on how to implementing the work as described will be very much appreciated:
1. Connect to the web server in asynchronous mode.
2. Send CGI command to request for some real time media stream (MPEG-4/ JPEG image).
3. Web server sends the media stream.
4. The application extracts the media data from HTTP or RTP(UDP) and pass to decoder library.
5. Then displays the decoded data on the MFC Windows (how should I display the decoded media stream on it)

Really appreciate for some advices and suggestions.  Thank you!
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 24351594
Alas, I know nothing about processing media streams.
However, if you look in the code at the posted link, in the CWebWorld::GetWebPage() fn, notice that the fn allocates a buffer and then use InternetReadFile to read it all at once.  It would also be possible to read it in blocks.  Read a block, pass it to a decoding / display fn, read another block, etc.
As a first pass, I'd simply use synchronous WinInet functionality.  Once that was working, you could try using the asynch option.   There is some example code here:
   SAMPLE: How to Use AsyncHTTP to Call WinInet APIs Asynchronously
   http://support.microsoft.com/kb/275046
0
 

Author Comment

by:cskiong
ID: 24354348
Hi DanRollins,

Thanks for the suggetsion, I'm doing the Asynchronous way.
I'll use some open source libraries to process the media streams.  However, I wonder how should I send the decoded data stream to the MFC applicatication to load it onto the UI, for example JPEG image and MPEG 4 stream?  I'm creating a dll library which will carry out all the WinInet things and also the data extraction and media stream decoding.  Some sample codes are very much appreciated.

Thank you!
0
 

Author Closing Comment

by:cskiong
ID: 31579730
Thanks DanRollins,
I found one of your post to a similar question, where you suggest to use different thread to do the synchronous WinInet call, and it is working fine to me.  Thanks for all the help.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which Microsoft MSDN Package Is The One I need? 3 48
Best book to learn C++ 4 84
WPF issue with Trigger 2 115
reboot server with scheduled time and week base 4 37
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question