Comments (1)
This is the help of the high-level sctpsocket object (obtained with sctp.sctpsocket_tcp() or sctp.sctpsocket_udp()):
| sctp_recv(self, maxlen)
| Receives an SCTP message and/or a SCTP notification event. The notifications
| that can be received are regulated by "events" property and its subproperties.
| See event_subscribe() class for details.
|
| It is important to know that sctp_recv() can return either on data messages or
| on subscribed events. If the application just wants data, it must unsubscribe
| the other events.
|
| Parameters;
|
| maxlen: the maximum message size that can be received. If bigger messages are
| received, they will be received in fragments (non-atomically). The application
| must choose this carefully if it wants to keep the atomicity of messages!
|
| Returns: (fromaddr, flags, msg, notif)
|
| fromaddr: address/port pair. For some applications, association ID will be more
| useful to identify the related association. Fortunately, assoc_id is
| a attribute of most notifications received via "notif" (see below)
|
| flags: a bitmap of lower-level recvmsg() flags (FLAG_* flags).
|
| FLAG_NOTIFICATION indicates that an event notification was
| returned, instead of a data message.
|
| FLAG_EOR indicates that this is the final fragment of a data message.
| Ideally, all messages will come with this flag set.
|
| WARNING: message data-related flags like MSG_UNORDERED are returned
| inside sndrcvinfo() notifications, and NOT here!
|
| msg: the actual data message. Since SCTP does not allow empty messages,
| an empty "msg" always means something special, either:
|
| a) that "notif" contains an event notificatoin, if "flags" has
| FLAG_NOTIFICATION set;
|
| b) that association is closing (for TCP-style sockets only)
|
| notif: notification event object. If "msg" is a data message, it will contain
| a sndrcvinfo() object that contains metadata about the message. If
| "flags" has FLAG_NOTIFICATION set, it will contain some notification()
| subclass.
|
| sndrcvinfo() is ALWAYS returned when a data message is received, but
| it will only contain useful data IF events.data_io is subscribed True.
|
| WARNING: the maximum message size that can be received via SCTP is limited:
|
| * by the underlying implementation. Check your operating system.
|
| * by the "maxlen" parameter passed. If message is bigger, it will be received
| in several fragments. The last fragment will have FLAG_EOR flag set.
|
| * by the socket's reception buffer (SO_SNDRCV). The application must configure
| this buffer accordingly, otherwise the message will be truncacted.
|
From here, if you want to know the length of the received data, you can simply use len(msg) after sctp_recv() returns.
from pysctp.
Related Issues (20)
- sctp ppid value error HOT 4
- undefined symbol: PyString_FromStringAndSize HOT 5
- The sent packet cannot be parsed by wireshark HOT 2
- SCTP payload protocol ID argument issue HOT 2
- [Query] PPID for received message? HOT 2
- bindx doesn't work with more than one address HOT 1
- SCTP keeps trying to socket-connect with a dummy IP for hours before it times out. HOT 5
- set_sndbuf doesn't work as expected HOT 2
- pypi version 0.7 is outdated HOT 3
- unable to run the code HOT 4
- Unable to install pysctp HOT 1
- How to configure source port for client HOT 1
- SCTP Server when receiving SCTP request from other subnet do not work? HOT 2
- Source address and add new address HOT 4
- CI/CD publishing to PyPi HOT 5
- Method for specifying the Payload Protocol Identifier for Data Chunk? HOT 1
- Byte-ordering is incorrect when trying to use ppid attribute of sctp_send HOT 2
- ppid field changed from 32 bits to 128 bits HOT 2
- ProcessLookupError: [Errno 3] No such process HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysctp.