C++ How to: Send Values over TCP/UDP

Posted on 2011-04-27
Last Modified: 2012-05-11
Dear Experts,

I would like to be able to echo the contents of cout to another computer, through using TCP/ UDP. Is there any command or function that you can think of that will allow me to do this.

Picture attached is related. I would like the ASCII dragon to be echoed/ output to the client below, and vise versa. The dragon is not received in blocking mode, a packet is merely received to allow the program to continue.

Cout UDP TCP C++ Network
Essentially what I want to know, is a way I can echo values (strings, int's, chars, etc.) from my console to another console via the network.

I currently used structured messages - should I just build upon the use of these?

Kind Regards, SME_Paddington
Question by:SME_Paddington
    1 Comment
    LVL 24

    Accepted Solution

    There is an excellent example of this in the libapr library from apache. I guess there will be some C++ wrapper for using it. The libapr homepage is:


    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
    The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now