Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added server SendTo method #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

gpayer
Copy link

@gpayer gpayer commented May 2, 2021

This pull request allows bidirectional communication. To enabled this a SendTo (analogue to PacketConn.WriteTo) was added to the Server struct. Now it is possible to both send messages to a server and receive its answers on the same port.

Further changes:

  • Store current connection in Server and use it. Therefor a SetConnection method was added as well and net.PacketConn parameters were removed.
  • Added Server.Listen(): enable the listening port, but do not start the Serve() loop yet. Useful if you send a message before listening for responses.
  • Packet.SenderAddress(): returns sender address (or nil) for the current message or bundle. This is necessary so a server can send responses to the correct address.

@gpayer gpayer mentioned this pull request May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant