Solved

WinInet to communicate with Web Server for real time media streams

Posted on 2009-05-08
5
280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

737 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