Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Networking question  (Read 3196 times)

0 Members and 2 Guests are viewing this topic.

Mad Engineer

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Networking question
« on: January 05, 2014, 02:23:04 pm »
Let's say i have 2 computers.
On one computer i have two applications that receive data.
With second computer i have application that is sending data.

How can i send data to specific application and not both of them, with only using one port.

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: Networking question
« Reply #1 on: January 05, 2014, 03:06:19 pm »
Only one application at a time can open a socket/port. Its bound to this application and the second one will fail to open the port :)

What do you wanna achive?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Networking question
« Reply #2 on: January 05, 2014, 03:17:04 pm »
Only one application at a time can open a socket/port. Its bound to this application and the second one will fail to open the port :)

Only one application can open a listener on a specific port (host), any number of applications can connect to that listener (client). This is exactly what he is trying to do....
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Mad Engineer

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Networking question
« Reply #3 on: January 05, 2014, 03:55:12 pm »
I was thinking on making master server console app that is always running on my computer, so when people want to play they click find game, and server makes list of players currently searching for a game. When there are enough people searching, master server app starts new .exe app that will handle current game that started. So i need to receive data with master server only when people are still searching for a game, and then when they find the game i want to receive data with .exe that is specific to their game.

I hope this is clear enough explanation.

If i can't make more apps on same port i think i will make list of games and handle them all with one app. And not start new console for every game.

This was only my quick solution on how to make "Find Game" system, and not make players type IP address and port farword. XD

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: Networking question
« Reply #4 on: January 05, 2014, 08:44:12 pm »
Only one application at a time can open a socket/port. Its bound to this application and the second one will fail to open the port :)

Only one application can open a listener on a specific port (host), any number of applications can connect to that listener (client). This is exactly what he is trying to do....

Is it?

"[...] two applications that receive data"
"[...] only using one port"

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Networking question
« Reply #5 on: January 05, 2014, 08:51:17 pm »
You can also make them search on a different port than the game data is send over. So your game server "provider" for example listens on port 67856 and once there are enough player ready, launches the actual game server which listens on port 67857.

This way you can communicate with both server-side applications. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mad Engineer

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Networking question
« Reply #6 on: January 05, 2014, 09:06:40 pm »
Yes that is true :D . But problem comes in again if there are more then one game active at the same time. (each active game has its own console application that is started when main server app gathers enough players )

I think i will handle main server app with TCP. And server-game apps with UDP since UPD is connectionless with self implemented delivery check for some important stuff like chat etc... ( correct me if i'm wrong here, but UDP can actually just watch for stuff that comes on specific port , whithout the need of handshake and listening to port like TCP does ?? )

Thank you all for responses this helped me make some decisions on how to implement stuff :D

 

anything