Click here to Skip to main content
14,599,397 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to create a graphical interface for writing TCP client / TCP server in C ++ which can send and receive data from both sides, please who can help me I am really lost

What I have tried:

I want to create a graphical interface for writing TCP client / TCP server in C ++ which can send and receive data from both sides, please who can help me I am really lost
Posted
Updated 30-May-20 8:08am
Comments
Member 14834230 27-Jun-20 11:03am
   
thank you all i made my graphical interface with successfully with visual studio 2010 but i want to change the server to accept and communicate multiple client can you help me please ?
Rate this:
Please Sign up or sign in to vote.

Solution 1

C++ doesn't have a built-in GUI library, so you have to find one that supports the platform that you're working on (e.g., Windows).

C++ doesn't have a socket library either, though one was proposed for C++20. I don't know if it was accepted, but even if it was, it might be a while before it's available on your platform. You therefore have to use something platform-specific again, such as winsock2.h on Windows.

I don't write GUI apps, so I can't help you there. But if you're working on Windows, you can find lots of TCP stuff in my GitHub repository[^], specifically in the nw directory.

I'm guessing, though, that you're trying to take on too much, based on your statement about being really lost. This is not a project for someone without a reasonable amount of experience.
   
Comments
Member 14834230 29-May-20 18:23pm
   
I work under windows with microsoft visual studio 2010 I created my project in console form but now I want to create a graphical interface I tried with MFC but it is not easy
Greg Utas 29-May-20 18:42pm
   
Maybe someone else can help you with this. I've never used MFC because a console application is more appropriate for what I do. I did make note of an interesting post, however, that mentioned a GUI library that is multi-platform. I have no experience with it, but perhaps it would be of help: https://www.wxwidgets.org/

Edit: Unless you're locked into VS2010 for your job or something, I hope you realize that you can download the "Community" edition of VS2019 or VS2017 (which is what I'm using, if you can still find it). It's free and better than VS2010.
Member 14834230 29-May-20 19:11pm
   
thank you alot for you answers i will try to found a solution
Rate this:
Please Sign up or sign in to vote.

Solution 2

MFC is considered a bit "old hat" by now, you can use .NET, see:
A programming tutorial on Windows Forms and controls for C++ .NET (C++/CLI) using the .NET framework class library[^]

Also see this plugin for VS: C++/CLR Windows Forms for Visual Studio 2019 - Visual Studio Marketplace[^]

If you are interested in writing cross-platform applications, take a look at: best-cross-platform-gui-toolkits[^]
Qt is well known and also offers a networking library, but expensive for commercial usage.
   
v5
Rate this:
Please Sign up or sign in to vote.

Solution 3

You can use MFC which has a complete GUI framework. Or you can use the Win32 GDI+ library if you are not well acquainted with MFC.
   
Comments
Member 14834230 8-Jun-20 6:02am
   
i had found some MFC applications but they are one side send end and other receive and when i i'd changed in both side send and receive it didn't work
Richard MacCutchan 8-Jun-20 6:17am
   
Then you must have done something wrong. Remember that the send and receive need to be handled correctly. They can take it in turns to send messages, and so synchronise with each other. Alternatively they can send and receive in separate threads so they can handle the receipt of unsolicited messages. Either way it is a question of getting the design right.
Rate this:
Please Sign up or sign in to vote.

Solution 4

When you are experienced with Visual Studio than you only need to create a dialog based app and than wire your networking stuff with some graphical elements.

As an example may help this Network sniffer which addresses similar stuff.

If you cant use MFC for some reasons, you may use the more modern and portable Qt framework.
   
Rate this:
Please Sign up or sign in to vote.

Solution 5

Here's a sample application that might get you started : Beginning Winsock Programming - Simple TCP client[^].

There are many similar sample applications at this site in a variety of languages and platforms. Search for "tcp chat" to start with and then refine your search terms to zero in on what you want.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100