Linux serverlinux web serverNETWORK ADMINISTRATIONS

C++ Sockets – Create simple server and client chat (Linux)

This is simple console server and chat client. This was my second semester final project, so I thought I’ll share with you.

Compiler: G++ Compiler

===== SOURCE FILES =====

https://github.com/hassanyf/Simple-Server-and-Chat-Program

Project Members:
Nabeel Hussain
Zain Mohsin

Thank you.

source

by Hassan Yousuf

linux web server

34 thoughts on “C++ Sockets – Create simple server and client chat (Linux)

  • hai, can this chatroom that using socket programing can be done in virtualbox?

  • This is awesome. Would've been even more helpful if you explained the code line by line

  • The links to download don't work, might want to try something else, maybe github?

  • This code limits server and client to enter one message at a time. A server or client cant send more than one message.
    Use threads instead

  • the links are not working. Source files are not reachable. Can you please share them again?

  • hey, can you tell me what socket programming project other ? except chat program?

  • The codes you wrote are buggy(e.g. sock.addr.sock_addr.s_addr instead of sock_addr.sin_addr.s_addr, and four or five others), plus upload the original codes of what you later compiled in your video, thx:)

  • How to install a compiler on a Linux server and embed that compiler to one website do anyone know if yes then the person is thankful to answer my question

  • not able to get the code, shows url not found, can you help.

  • hmm…can you do a video to create a server for android app client? plz?

  • can we use this program and send messages between two PCs which are connected through LAN??

  • Thank you very much for the nice video shared! One dumb question. that "127.0.0.1" has to be the ip address of the machine where server locates at , right? Thanks a lot.

  • I got a problem with a buffer overflow.

  • Assalam'aleyk brother

    i have one question. i know this for linux, but can it be run on windows? does the code has special character or anything that make these only for linux?

    thank you in advance bro ! this is exactly my project

  • Hi,
    looks amazing programs, I would like to test these, but I couldn't download the programs through the links provided. what shall I do?

  • hello Hassan, i need your help for my project, can i ask you a few question about server and client?

  • how can I make it work to communicate with another computer outside my LAN? btw, nice work and thanks for sharing!

  • Hassan Thank you for this video.I can connect server client on the same pc.But my purpose is communication from different computers. I want to connect ip="192.168.X.X" .how can i do this?

  • i used the file you putted in the description of the video but when i try to run them i got stuck D:
    the client says => Socket client has been created… and then stops
    the server says => Socket server has been created…
    => Looking for clients…

    sorry if this is just a my error 😀

  • What ?! Because he doesn't make me Download the file on ADF.LY ?

    Thank you guys for The answere

  • hello I getting error while compiling the client.cppclient.cpp: In function ‘int main()’:
    client.cpp:18:13: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
      char *ip = "127.0.0.1";
                 ^
    client.cpp:36:34: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
      recv(client, bufsize, bufsize, 0);
                                      ^
    In file included from client.cpp:4:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:156:16: error:   initializing argument 2 of ‘ssize_t recv(int, void*, size_t, int)’ [-fpermissive]
     extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);can you help me?? thank you

  • Is there a way to make it so that you can have two different computers communicate with each other through this, or it will only work with two terminal windows side by side

  • Really nice video, thank you. I study at UNB from capital of Brasil (Brasilia), we are doing some work about server and clints, professor did not help too much but your video did. Keep sharing your work with us, it really help.

Comments are closed.