I am trying to do sctp programming using Python2.6 and pysctp package. I was able to capture the message from the server but was not able to extract the hex dump of the received message from sctp socket. And how to send my responseHex as response using the same socket to the connected server.
Assume my server is independent of this client and it continuously trying to connect with the 192.168.10.13 address.
Code:
#!/usr/bin/python
import sys
import socket
import pysctp
import pysctp.sctp as sctp
MAXRECVBUFFERSIZE = 2048
bindingIp = "192.168.10.13"
socketPort = 112233;
socket = sctp.sctpsocket_tcp(socket.AF_INET);
responseHex =[0xd0, 0x36, 0x02, 0x5a, 0x00, 0x51, 0x03, 0x00, 0x15, 0x00, 0x08, 0x00, 0x11];
socket.events.clear();
socket.bind((bindingIp, socketPort));
socket.listen(3);
client, addr = socket.accept();
buffer = client.recv(MAXRECVBUFFERSIZE);
print buffer // This prints binary dump on the terminal
// And I want to send hexResponse variable through the same socket
socket.close();
exit(0)