I am writing simple server client programs using socket, in which a client would request a video file and the server should send it that file. After recieving the file the client would play that video file. I know how to open ordinary text files and binary files but can a video file be opened in the same manner i.e fopen ("file.avi", "rb"); and which library and its corresponding function should i use to play that video file on the client side.

What libraries or other tools you use to play the video depends entirely upon the encoding that the video uses. Downloading it is trivial, but playing it is not. As I implied, there are many video encodings to deal with, some of which are proprietary (mpeg2, etc), and others that are open-sourced (mkv). In any case, usually to solve this sort of problem I would pipe the downloaded data to a tool that can deal with most any format, such as the VLC (open source) media player, or stream it with ffmpeg (another open source video tool / transcoder).

What I am trying to say, is that this is NOT a simple problem! You have your work cut out for you to deal with this. :-)

And FWIW, I have been doing video processing/transcoding/streaming for about 10 years now.

@rubberman: Thanks alot man for your response. I am also realising that it's not that simple as it seemed ;) but i am going for ffmpeg and i hope learning it will solve the issue :)

You might be able to do this by programming using DirectShow and Windows SDK. You can get started by reading the information in the following pages:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375468%28v=vs.85%29.aspx
http://stackoverflow.com/questions/3481713/how-to-get-started-with-directshow

Note that I tried programming directly with DirectShow before, but it was too complex, because I don’t have a good background knowledge in DirectShow programming.
Now, I am using a programming toolkit (leadtools) that wrapped all of the DirectShow stuff in high level interfaces. Also, it can stream videos and it supports many protocols. If you need more information, you can refer to this page:
http://www.leadtools.com/help/leadtools/v18/multimedia/api/introduction_to_the_leadtools_video_streaming_module.html

Also, see the following post:
http://support.leadtools.com/CS/forums/25135/ShowPost.aspx

Sorry for the double post. Is there any way to delete it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.