Voice Communication via Network/Internet | CodeGuru

Voice Communication via Network/Internet

This article was contributed by Zhaohui Xing. Environment: Windows NT4/2000 and Visual C++ 5.0 (and greater) This is the simplest prototype to demonstrate how to realize a basic Voice Communication via Internet/Network on PC platforms. The technique in this demo can be applied to develop the PC internet voice communication software, such as Internet Phone. […]

Written By
CodeGuru Staff
CodeGuru Staff
Jun 24, 2000
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

This article was contributed by
Zhaohui Xing.

Environment: Windows NT4/2000 and Visual C++ 5.0 (and greater)

This is the simplest prototype to demonstrate how to realize a basic Voice
Communication via Internet/Network on PC platforms. The technique in this demo can be
applied to develop the PC internet voice communication software, such as Internet Phone.

To save development time, I borrowed the idea of Client/Server design in Microsoft MSDN
sample "GlabolChat". 

This sample has been tested in a intranet consisted of NT4.0 Server/Workstation and a
LAN consisted of Win2000 Professional. The CPUs in the testing PC are at least  Intel
P2 266 or faster, and SoundCard, Mic, Speaker are must.

In the tests, it can work smoothly in bi-directions voice talk with the a acceptable
sound quality.

The basic system design

This sample contain two modules, Talkserver and Talkclient.

The basic system diagram is like:

System diagram

 

Server Module

Server module has two type sockets, server sockets and client sockets. One server
socket supports a certain network protocol and listens the incoming connection with such
protocol. When a client connection request comes, the server socket create a client socket
to build the link with the client. The client socket works to receive the messages from
its client, transit the message to peer client socket, then the peer client socket send
the messages to the target client. The client socket also get the messages from the peer
  socket and send these message to its client.  

 

Client Module

The user can use the client modules to communicate in voice with each other. The socket
in the client is implemented as sending/receiving messages to/from the server.

The method to capture and transit sound data in client module is  building and
runing a wave input device, when this wave input device records enough to size of the data
buffer in its wave header structure, it notifies client instance. When the client receives
the wave input device message, client retrieves the sound data in the wave input device
buffer, then encodes the sound data into the voice communication message and sends to the
peer (or target) client.

To play a voice message is similar. The client has a wave out device. After the client
receive voice message from other client, it decodes the sound data from the message, put
the sound data to the wave output device and drives it to play the sound. 

 

Advertisement

Change sound quality

By changing the wave device buffer and wave format type defined in vtDef.h, you can
change the sound quality in some kind of levels. 

Downloads

Download the project – 253 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.