Sockets and ports | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Sockets and ports

Hello World! I want to program a chat application that will work out of local Host. Can I do this? For example if I exchange ip address with my friend can we communicate from this app? I searched a little bit about this topic and I found something for sockets and ports. Can you explain what is this

12th Feb 2019, 4:13 PM
Lighton
Lighton - avatar
4 Answers
+ 1
you’ll need to get a web host account with a service. its pretty cheap, like $4 USD a month. you can host your chat application there. If you’re building the application using java, you can build a server to accept socket connections and you’ll need to build the client that people will use on their devices (computer, phone, or whatever you’re making it for). then have the client connect to the server using sockets to transmit data and if you want, store chat information in a database on the host server.
12th Feb 2019, 5:06 PM
Hazmat
Hazmat - avatar
+ 1
Can I organize my computer as a server to avoid 4$? I want to make it because I want to learn more about servers and internet.
12th Feb 2019, 7:16 PM
Lighton
Lighton - avatar
0
you can, you’ll need to download a server on your computer and read online about how to configure it to allow it to be connected to the internet. Note: By opening your computer to the internet, hackers will also try to access your computer so you need to be able to set everything up correctly or your computer and personal information may be compromised.
13th Feb 2019, 1:16 AM
Hazmat
Hazmat - avatar
0
actually, you can skip downloading a server and configuring it completely. you could just find out your public IP Address and build your own server for your app. if you do it that way, you will still need to protect yourself from attacks but you can have a bit more control over what people can try to access and you wont have so much to worry about. you can just build the server on your computer and build the clients on your computer too. you have to send the clients to other devices you want to use them on and use the sockets that connect to your home IP from other IPs outside of your home. that should be a more managable situation.
13th Feb 2019, 1:19 AM
Hazmat
Hazmat - avatar