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!!
It's the best tutorial i've ever seen, very clear! Thanks for helping me learn socket programming.
Thank you so much♥️
Thanks JJ! I just now written the server , client code and executed succussfully.
Hey it worked! I wrote my own chat app using sockets, very cool!
Thank you 😊
Very good explanations and easy to grab the things. Thank you very much
Very nice explanation..
Thanks for sharing it.
Very well explained tutorial. Thanks a lot
Yo This tutorial is LIT 🔥🔥🔥🔥
Lol I think those who dislike they directly watched this video.. Thanks. For wonderful explanation
i am so grateful for this tutorial!!!
AAAA closing curly brace on line 47 is killing my soul. Anyway, great job, man))
😂thankss
o my GOD, you are the best!!!!!!!!!!!!!!!!!!!! thank you!!!!!!!
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.
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.
@@thinkandlearn7258 what changes would be neccesary for doing so?
@@thinkandlearn7258 could you explain that?
thank you for helping JJ aka Jay Jagtap
Unable to access the google drive in the description
Showing access denied
very nice tutorial sir...
great experience..
thanks bro helped me a lot
Really helpful! thanks alot.
Thank YOU!! Happy Learning!
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?
lovely tutorial
great tutorial..
Amazing man❤️
Awesome dude, but you have to more clear things about why we use type casting , etc
Thanks for this wonderful suggestion. I will try to make more in depth tutorials in future. Happy Learning!!
deserves more views
me ayudo a pasar mi materia, resolví el problema para mi proyecto final
at 6:09 I am getting an error which says "hostent has no field h_addr", What should I do Sir?
For those who are having the same problem, You can write
server->h_addr_list[0]
I have two pcs how do I connect them through this code and do the same thing in different pcs rather than different terminals.
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.
Did you solve the problem?
@@giannipex7328 i need this too
very well thought
hey man, its really helpful. but i am getting segmentation fault (core dumped) error. how to solve it?
Check the code once line by line. Core dumped gives us no idea where exactly the error can be.
Check your opening and closing braces
But in this code we cant use multiple clients
I am getting error after running server side code
Error- usage ./server hostname
How to resolve this?
It is not showing the messages sent simultaneously when I exit the connection only it is showing the message any help plzzz??
Can't we do that like anyone of server or client can initiate the chat like in your video your client is initiating chat.
Hello, can i know how to access your google drive? :)
A program where multiple/2 clients can communicate via single server?
Which software did you use for this code
hey
nice tutorial but i am bit stuck at the connection part
can you help in figuring the error ?
Which compiler is ?
how to share 1 gb large files between server and client? could you please help.
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
Running on single machine but shows error while connecting two machines
did you find the issue , i am facing the same issue
thanku
Kindly share the code
I copied your code but it's not working
how can i encrypt the chat
(i want to encryption the chat )
I have never done encryption in the chat.But, check this, this may help gist.github.com/bricef/2436364
can you help me in write the code cuse im not good in C
how much different is socket programming in windows?
Not different at all
can any 1 help me ! how can i find the local inet addr on windows 10 ?? pleaseee answer me :'(
will it work with different machines over the internet by the IP address?
Please reply it is urgent...
Yes it will.
@@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?
Bro how to make an application with this code
For C , C++ you can use QTCreator for creating GUI
Then how to develop a chatting application with socket. Plz help me to do this
How to send the msg to another pc bro
Error displayed in client part
bash: ./client : no such file or directory
Bug ZapperZ check what you saved your client .c file as
got error while oppening socket :/
got Error on writing: broken pipe
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
You haven't included . Get that file in , the structure belongs to this header file.
i inluded #include already its still getting error
after server -> at this arrow it showing error like above..
Can you copy paste the complete error, so that i get an idea.
Or you can test run my code and then compare. You can find the drive link in the description.
Good tutorial but why do you keep making silly mistakes, like exit(0).
ichi padesaad gaa
Burra paduu!!
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.
Suggestion noted. Thanks ☺️
@@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 :)
thank you man , please where server.c code ?
kindly give access
thank you soo much!🤍
I am getting error after running server side code
Error- usage ./server hostname
How to resolve this?
getting segment fault with bcopy any another method