Skip to content

Commit

Permalink
[sparckles#854] docs: add docstring to Robyn#get_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Jun 24, 2024
1 parent 2c1381e commit 1078972
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def shutdown_handler(self, handler: Callable) -> None:
self._add_event_handler(Events.SHUTDOWN, handler)

def get_socket(self, url: str, port: int) -> (bool, SocketHeld):
"""
@param url: the host URL
@param port: the port number
@return: a tuple containing a bool that denotes whether
the socket was acquired or not followed by the actual socket, if successful
"""
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(("localhost", port)) != 0, SocketHeld(url, port)
Expand Down

0 comments on commit 1078972

Please sign in to comment.