public int sendTCP ( Object object ) { if ( object == null ) throw new IllegalArgumentException ( "object cannot be null." ) ; try { int length = tcp . send ( this , object ) ; if ( length == 0 ) { if ( TRACE ) trace ( "kryonet" , this + " TCP had nothing to send." ) ; } else if ( DEBUG ) { String objectString = object == null ? "null" : object . getClass ( ) . getSimpleName ( ) ; if ( ! ( object instanceof FrameworkMessage ) ) { debug ( "kryonet" , this + " sent TCP: " + objectString + " (" + length + ")" ) ; } else if ( TRACE ) { trace ( "kryonet" , this + " sent TCP: " + objectString + " (" + length + ")" ) ; } } return length ; } catch ( IOException ex ) { if ( DEBUG ) debug ( "kryonet" , "Unable to send TCP with connection: " + this , ex ) ; close ( ) ; return 0 ; } catch ( KryoNetException ex ) { if ( ERROR ) error ( "kryonet" , "Unable to send TCP with connection: " + this , ex ) ; close ( ) ; return 0 ; } }
Sends the object over the network using TCP .