Well, something strikes me immediately within you code. I cannot see import socket (which i think is the library to use TCP or UDP protocol and a lot of other stuff)
Which library the "server" command is taken out of ? I'm definitely not experienced in python coding but is it part of the basical python environment ? don't you need to import a library ?
In my code I personally use the Pyosc library in order to send the data through OSC (which is a formatted UDP-style protocol widely used with pure data, max/msp, processing, etc...), so i don't use the "server" method