Solved

WinInet to communicate with Web Server for real time media streams

Posted on 2009-05-08
5
273 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now