I am attempting to write a program that uses both a TCP and UDP connection. However, on the client side, attempting to create the TCP connection goes fine but the UDP connection throws windows error 10048 (Only one usage of each socket address (protocol/network address/port) is normally permitted). This is true even if they use different ports. What am I missing?
EDIT: Here is the relevant code:
serverName = 'localhost'
serverPort = 32000
TCPSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
UDPSocket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
print('socket created')
TCPSocket.connect((serverName, serverPort))
print('TCP connection successful')
# the variable UDPPort is taken from a TCP message
#sent by the server earlier in the program
UDPSocket.bind((serverName, UDPPort))
Edit 2: I am still having this issue, and want to bump this thread. Hopefully this works and is allowed.
Edit 3: The initial issue I believe is fixed, but I'm having a new issue as described below.