This should work. but need to find more efficient way of transmitting int over TCP socket