[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

WinInet to communicate with Web Server for real time media streams

Posted on 2009-05-08
5
Medium Priority
?
284 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 1500 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

656 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