* connection.
*/
private SMPPPacket readNextPacketInternal()
throws java.io.IOException, SMPPProtocolException {
try {
SMPPPacket pak = null;
int id = -1;
this.buf = link.read(this.buf);
id = SMPPIO.bytesToInt(this.buf, 4, 4);
pak = PacketFactory.newInstance(id);
if (pak != null) {
pak.readFrom(this.buf, 0);
if (LOGGER.isDebugEnabled()) {
StringBuffer b = new StringBuffer("Packet Received: ");
int l = pak.getLength();
int s = pak.getCommandStatus();
int n = pak.getSequenceNum();
b.append("id:").append(Integer.toHexString(id))
.append(" len:").append(Integer.toString(l))
.append(" st:").append(Integer.toString(s))
.append(" sq:").append(Integer.toString(n));
LOGGER.debug(b.toString());