def __init__(self, XMLCFG): try: Msg = "Connector init ..." PCA_GenLib.WriteLog(Msg, 9) self.XMLCFG = XMLCFG Tag = "REMOTE_HOST" host = PCA_XMLParser.GetXMLTagValue(XMLCFG, Tag) Tag = "CONNECT_PORT" connect_port = PCA_XMLParser.GetXMLTagValue(XMLCFG, Tag) self.host = host self.connect_port = string.atoi(connect_port) if _sctp.getconstant("IPPROTO_SCTP") != 132: Msg = "Connector init getconstant failed" PCA_GenLib.WriteLog(Msg, 0) Msg = "Call SCTP Socket..." PCA_GenLib.WriteLog(Msg, 7) # make a TCP/IP spocket object self.SocketDescriptor = sctp.sctpsocket_tcp(sctp.socket.AF_INET) self.saddr = (self.host, self.connect_port) Msg = "Host=<%s>,Port=<%s>" % (self.host, self.connect_port) PCA_GenLib.WriteLog(Msg, 7) self.SocketDescriptor.initparams.max_instreams = 3 self.SocketDescriptor.initparams.num_ostreams = 3 self.SocketDescriptor.events.clear() self.SocketDescriptor.events.data_io = 1 Msg = "Connector OK." PCA_GenLib.WriteLog(Msg, 9) except: Msg = "Connector Initial error : <%s>,<%s> " % (sys.exc_type, sys.exc_value) PCA_GenLib.WriteLog(Msg, 0) raise
# details. # # You should have received a copy of the GNU Lesser General Public License # along with this library; If not, see <http://www.gnu.org/licenses/>. import sys import time import socket import _sctp import sctp addr_client = ("127.0.0.1", 10002) addr_server = ("127.0.0.1", 10001) if _sctp.getconstant("IPPROTO_SCTP") != 132: raise(Exception("getconstant failed")) def init_server(): srv = sctp.sctpsocket_tcp(socket.AF_INET) srv.bind(addr_server) srv.listen(5) return srv def test_cli(): srv = init_server() # cli = sctp.sctpsocket_tcp(socket.AF_INET) # config SCTP number of streams cli.initparams.max_instreams = 3 cli.initparams.num_ostreams = 3
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with this library; If not, see <http://www.gnu.org/licenses/>. import sys import time import socket import _sctp import sctp addr_client = ("127.0.0.1", 10002) addr_server = ("127.0.0.1", 10001) if _sctp.getconstant("IPPROTO_SCTP") != 132: raise (Exception("getconstant failed")) def init_server(): srv = sctp.sctpsocket_tcp(socket.AF_INET) srv.bind(addr_server) srv.listen(5) return srv def test_cli(): srv = init_server() # cli = sctp.sctpsocket_tcp(socket.AF_INET) # config SCTP number of streams