/** When new data is received through the TcpConnection. */ public void onReceivedData(TcpConnection tcp_conn, byte[] data, int len) { last_time = System.currentTimeMillis(); text += new String(data, 0, len); SipParser par = new SipParser(text); Message msg = par.getSipMessage(); while (msg != null) { // System.out.println("DEBUG: message len: "+msg.getLength()); msg.setRemoteAddress(tcp_conn.getRemoteAddress().toString()); msg.setRemotePort(tcp_conn.getRemotePort()); msg.setTransport(PROTO_TCP); msg.setConnectionId(connection_id); if (listener != null) listener.onReceivedMessage(this, msg); text = par.getRemainingString(); // System.out.println("DEBUG: text left: "+text.length()); par = new SipParser(text); msg = par.getSipMessage(); } }
/** Gets the remote port */ public int getRemotePort() { if (tcp_conn != null) return tcp_conn.getRemotePort(); else return 0; }