Code the Client - Running our Chat Application | Socket Programming | Tutorial No 6

Поділитися
Вставка
  • Опубліковано 8 лют 2025
  • Socket Programming Tutorial No 6 : Client code and Executing Chat Application.
    Hello guys, this is JJ insta: jj_this_is.
    Today we will write the code on Client side.
    I have explained the command line arguments like portno and server's Ip address.
    ifconfig gives you the IP address of the server machine which you need to pass as an command line argument to connect to a already powered on Server on a different machine.
    If you want to simulate the conditions on the same machine then you need to use the loopback address i.e 127.0.0.1
    It was great teaching you all guys about Client- Server Chat apllication.
    Here are the code files(Caution : I strongly recommend to type in the code , Use this file only if you require.)
    drive.google.c...
    Like , Share and Subscribe.
    JJ Here!!
    Happy Learning!!

КОМЕНТАРІ • 95

  • @林大帥哥-j9f
    @林大帥哥-j9f 6 років тому +13

    It's the best tutorial i've ever seen, very clear! Thanks for helping me learn socket programming.

  • @sivaramakrishnachitithoti839
    @sivaramakrishnachitithoti839 Рік тому +2

    Thanks JJ! I just now written the server , client code and executed succussfully.

  • @jimivie
    @jimivie 3 роки тому +2

    Hey it worked! I wrote my own chat app using sockets, very cool!

  • @hasanthalakshan5203
    @hasanthalakshan5203 5 місяців тому

    Very good explanations and easy to grab the things. Thank you very much

  • @yasirarafat9946
    @yasirarafat9946 6 років тому +2

    Very nice explanation..
    Thanks for sharing it.

  • @canaldoobmarcos4141
    @canaldoobmarcos4141 Рік тому

    Very well explained tutorial. Thanks a lot

  • @sinnerman-i4r
    @sinnerman-i4r 4 роки тому +2

    Yo This tutorial is LIT 🔥🔥🔥🔥

  • @sanketkushwaha4238
    @sanketkushwaha4238 3 роки тому +1

    Lol I think those who dislike they directly watched this video.. Thanks. For wonderful explanation

  • @kuko932
    @kuko932 3 роки тому

    i am so grateful for this tutorial!!!

  • @georgikovalenchik3028
    @georgikovalenchik3028 6 років тому +2

    AAAA closing curly brace on line 47 is killing my soul. Anyway, great job, man))

  • @kuko932
    @kuko932 3 роки тому

    o my GOD, you are the best!!!!!!!!!!!!!!!!!!!! thank you!!!!!!!

  • @classmate3146
    @classmate3146 5 років тому +5

    Nice explanation Sir,
    but Sir why we can not send more than one message to each other at the same time?
    like :
    Server: Hi
    Server: I 'm Jan.
    in this case, the client receives only the first Message (Hi).
    and when the client replies the first message (Hi) to the server then the second message immediately come to the client.
    I hope I understood you.

    • @thinkandlearn7258
      @thinkandlearn7258  5 років тому

      Nice observation. That can also be done. U can read the complete file as one string and transfer. Just need to make corresponding changes in code.

    • @mrbean8916
      @mrbean8916 5 років тому

      @@thinkandlearn7258 what changes would be neccesary for doing so?

    • @simonius01
      @simonius01 4 роки тому

      @@thinkandlearn7258 could you explain that?

  • @gadgetsknowledge9977
    @gadgetsknowledge9977 5 років тому

    thank you for helping JJ aka Jay Jagtap

  • @beinghappy9223
    @beinghappy9223 2 роки тому +1

    Unable to access the google drive in the description
    Showing access denied

  • @kumarpratik6036
    @kumarpratik6036 4 роки тому

    very nice tutorial sir...
    great experience..

  • @abhijeetgupta1493
    @abhijeetgupta1493 2 роки тому

    thanks bro helped me a lot

  • @rishabkumar6375
    @rishabkumar6375 7 років тому +1

    Really helpful! thanks alot.

  • @hp-qx7tf
    @hp-qx7tf 5 місяців тому

    How come the terminals running the client and server quit their processes when both sides say "Bye!"? Shouldn't bye on the server be enough to break the loop and return 0?

  • @junkeirahacker6772
    @junkeirahacker6772 4 роки тому

    lovely tutorial

  • @sharavanraj9322
    @sharavanraj9322 2 роки тому

    great tutorial..

  • @mumbaikachallenge5526
    @mumbaikachallenge5526 2 роки тому

    Amazing man❤️

  • @hasanimran8056
    @hasanimran8056 7 років тому +1

    Awesome dude, but you have to more clear things about why we use type casting , etc

    • @thinkandlearn7258
      @thinkandlearn7258  7 років тому +1

      Thanks for this wonderful suggestion. I will try to make more in depth tutorials in future. Happy Learning!!

  • @Bluedot_10
    @Bluedot_10 5 років тому

    deserves more views

  • @ivangonzalezpolicarpio9513
    @ivangonzalezpolicarpio9513 4 роки тому

    me ayudo a pasar mi materia, resolví el problema para mi proyecto final

  • @Xp-Sam
    @Xp-Sam 4 роки тому +1

    at 6:09 I am getting an error which says "hostent has no field h_addr", What should I do Sir?

    • @Xp-Sam
      @Xp-Sam 4 роки тому +4

      For those who are having the same problem, You can write
      server->h_addr_list[0]

  • @vibe7_e_s
    @vibe7_e_s Рік тому

    I have two pcs how do I connect them through this code and do the same thing in different pcs rather than different terminals.

  • @tlthomas851
    @tlthomas851 6 років тому +3

    This is great and worked perfectly. I do have one question. Is there a way to make it so that the client or server can send and display multiple messages without having to have the other side respond? I notice that I can send multiple messages, but only the first message shows up until the server/client responds to the initial message.

    • @giannipex7328
      @giannipex7328 5 років тому

      Did you solve the problem?

    • @mrbean8916
      @mrbean8916 5 років тому

      @@giannipex7328 i need this too

  • @PraveenKumar-mu7pp
    @PraveenKumar-mu7pp 5 років тому

    very well thought

  • @junaidali-jp5op
    @junaidali-jp5op 6 років тому +4

    hey man, its really helpful. but i am getting segmentation fault (core dumped) error. how to solve it?

    • @thinkandlearn7258
      @thinkandlearn7258  6 років тому +2

      Check the code once line by line. Core dumped gives us no idea where exactly the error can be.

    • @anuragparcha4483
      @anuragparcha4483 5 років тому +2

      Check your opening and closing braces

  • @deveshgiri5674
    @deveshgiri5674 5 років тому +2

    But in this code we cant use multiple clients

  • @pranavambore9831
    @pranavambore9831 4 роки тому

    I am getting error after running server side code
    Error- usage ./server hostname
    How to resolve this?

  • @saidhanyasudhan3160
    @saidhanyasudhan3160 4 роки тому

    It is not showing the messages sent simultaneously when I exit the connection only it is showing the message any help plzzz??

  • @shehryarshujaat1626
    @shehryarshujaat1626 5 років тому

    Can't we do that like anyone of server or client can initiate the chat like in your video your client is initiating chat.

  • @Miiiera
    @Miiiera 3 роки тому +2

    Hello, can i know how to access your google drive? :)

  • @joyalmeida6565
    @joyalmeida6565 3 роки тому

    A program where multiple/2 clients can communicate via single server?

  • @bdworld3608
    @bdworld3608 4 роки тому

    Which software did you use for this code

  • @talhaabbas3720
    @talhaabbas3720 5 років тому

    hey
    nice tutorial but i am bit stuck at the connection part
    can you help in figuring the error ?

  • @yogeshbadiger8535
    @yogeshbadiger8535 3 роки тому

    Which compiler is ?

  • @anchalajay9715
    @anchalajay9715 5 років тому

    how to share 1 gb large files between server and client? could you please help.

  • @toploz_jr5597
    @toploz_jr5597 5 років тому

    how do i free the port? after i've used it i have to use another one for another server program launch or it will give me an error on bind

  • @ninaddeogaonkar6283
    @ninaddeogaonkar6283 5 років тому +1

    Running on single machine but shows error while connecting two machines

    • @shivam-codes
      @shivam-codes 2 роки тому

      did you find the issue , i am facing the same issue

  • @filimkun
    @filimkun 2 роки тому

    thanku

  • @831_sohampatra5
    @831_sohampatra5 Рік тому

    Kindly share the code
    I copied your code but it's not working

  • @ahmadalkhateeb94
    @ahmadalkhateeb94 7 років тому +1

    how can i encrypt the chat
    (i want to encryption the chat )

    • @thinkandlearn7258
      @thinkandlearn7258  7 років тому

      I have never done encryption in the chat.But, check this, this may help gist.github.com/bricef/2436364

    • @ahmadalkhateeb94
      @ahmadalkhateeb94 7 років тому

      can you help me in write the code cuse im not good in C

  • @junkeirahacker6772
    @junkeirahacker6772 4 роки тому

    how much different is socket programming in windows?

  • @yassineelghizi8022
    @yassineelghizi8022 5 років тому

    can any 1 help me ! how can i find the local inet addr on windows 10 ?? pleaseee answer me :'(

  • @amaanansari1604
    @amaanansari1604 4 роки тому +1

    will it work with different machines over the internet by the IP address?
    Please reply it is urgent...

    • @thinkandlearn7258
      @thinkandlearn7258  4 роки тому +1

      Yes it will.

    • @amaanansari1604
      @amaanansari1604 4 роки тому +1

      @@thinkandlearn7258 but it is working only when different systems are connected to same network. What can I do to run the codes on different systems using different internet connection?

  • @SanthoshCreationz
    @SanthoshCreationz 6 років тому +2

    Bro how to make an application with this code

    • @thinkandlearn7258
      @thinkandlearn7258  6 років тому

      For C , C++ you can use QTCreator for creating GUI

    • @SanthoshCreationz
      @SanthoshCreationz 6 років тому

      Then how to develop a chatting application with socket. Plz help me to do this

  • @balaji9623
    @balaji9623 4 роки тому

    How to send the msg to another pc bro

  • @SanthoshCreationz
    @SanthoshCreationz 6 років тому

    Error displayed in client part
    bash: ./client : no such file or directory

    • @anuragparcha4483
      @anuragparcha4483 5 років тому

      Bug ZapperZ check what you saved your client .c file as

  • @mrgreen5903
    @mrgreen5903 6 років тому

    got error while oppening socket :/

  • @georrgy
    @georrgy 5 років тому

    got Error on writing: broken pipe

  • @aejazbasha2838
    @aejazbasha2838 7 років тому +1

    i am getting error at server = gethostbyname(argv[1]);
    and
    error: dereferencing pointer to incomplete type ‘struct hostnet’
    bcopy((char *)server-> h_addr, (char*)&serv_addr.sin_addr.s_addr, server->h_length);
    how to solve this

    • @thinkandlearn7258
      @thinkandlearn7258  7 років тому

      You haven't included . Get that file in , the structure belongs to this header file.

    • @aejazbasha2838
      @aejazbasha2838 7 років тому

      i inluded #include already its still getting error

    • @aejazbasha2838
      @aejazbasha2838 7 років тому

      after server -> at this arrow it showing error like above..

    • @thinkandlearn7258
      @thinkandlearn7258  7 років тому

      Can you copy paste the complete error, so that i get an idea.

    • @thinkandlearn7258
      @thinkandlearn7258  7 років тому

      Or you can test run my code and then compare. You can find the drive link in the description.

  • @yahiya
    @yahiya 5 років тому

    Good tutorial but why do you keep making silly mistakes, like exit(0).

  • @jayabharat2700
    @jayabharat2700 4 роки тому +1

    ichi padesaad gaa

  • @Speedj2
    @Speedj2 5 років тому +1

    for the love of god, please align your code. the auto alignment from the app you're using is aweful XD
    everything past line 42 started getting me so confused, made even worse by that ambiguous curly brace at line 47
    otherwise great explanation, though, thanks man.

    • @thinkandlearn7258
      @thinkandlearn7258  5 років тому +2

      Suggestion noted. Thanks ☺️

    • @Speedj2
      @Speedj2 5 років тому +1

      ​@@thinkandlearn7258 hey man, just wanted to say thanks again, you did a pretty good job with this.
      alignment issues notwithstanding :P i really like the fact that you talk about what each of the #included library files is there for. and not only that but as you go through the code, you mention specifically which library file certain functions and structs come from. this is incredibly helpful information that a shocking number of programming guides and tutorials out there fail to include. this helps me not only to be able to get the example programs you make working for me, but also gives me the knowledge i need to learn more about these functions and apply things used in this project elsewhere.
      also, once i realized that this video was actually number 6 in a series, i actually went back and have been watching the entire series. it has been extremely helpful and you've helped me understand some things that i've been struggling with for weeks and understand them well enough that i've been able to apply what i learned to a very different program that i'm working on that makes use of a tcp client server connection.
      subscribed :)

  • @odayalwahsh
    @odayalwahsh 4 роки тому

    thank you man , please where server.c code ?

  • @rendp12345
    @rendp12345 2 роки тому

    kindly give access

  • @priyankam5631
    @priyankam5631 2 роки тому

    thank you soo much!🤍

  • @pranavambore9831
    @pranavambore9831 4 роки тому

    I am getting error after running server side code
    Error- usage ./server hostname
    How to resolve this?

  • @jayantanand7327
    @jayantanand7327 4 роки тому

    getting segment fault with bcopy any another method