TCP Server Issues

When Attempting To Write The TCP Server for the Information Security Course on freeCodeCamp when running it came up with this error
PS C:\Users\Gavyn\Documents\GitHub\python-pentesting> & C:/Python311/python.exe c:/Users/Gavyn/Documents/GitHub/python-pentesting/tcp-server/
Traceback (most recent call last):
File “c:\Users\Gavyn\Documents\GitHub\python-pentesting\tcp-server\”, line 8, in
host = socket.gethostbyname()
TypeError: gethostbyname() takes exactly 1 argument (0 given)
PS C:\Users\Gavyn\Documents\GitHub\python-pentesting>

[Here is a link to my code on Github](

Hi @galejandro , the error itself is telling you what is going on. You are trying to use a function that needs a parameter and is not optional. According documentation, you have to pass it the hostname “hostname - The name of the host system for which IP address resolution is needed.” for example:

hostName    = ""

ipAddress   = socket.gethostbyname(hostName)

I hope it helps. bests

Hi @ssulbaran, thank you so much. That makes a bit more sense now.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.