socket.pxd 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """0MQ Socket class declaration."""
  2. #
  3. # Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
  4. #
  5. # This file is part of pyzmq.
  6. #
  7. # pyzmq is free software; you can redistribute it and/or modify it under
  8. # the terms of the Lesser GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # pyzmq is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # Lesser GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the Lesser GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. #-----------------------------------------------------------------------------
  21. # Imports
  22. #-----------------------------------------------------------------------------
  23. from .context cimport Context
  24. #-----------------------------------------------------------------------------
  25. # Code
  26. #-----------------------------------------------------------------------------
  27. cdef class Socket:
  28. cdef object __weakref__ # enable weakref
  29. cdef void *handle # The C handle for the underlying zmq object.
  30. cdef bint _shadow # whether the Socket is a shadow wrapper of another
  31. # Hold on to a reference to the context to make sure it is not garbage
  32. # collected until the socket it done with it.
  33. cdef public Context context # The zmq Context object that owns this.
  34. cdef public bint _closed # bool property for a closed socket.
  35. cdef public int copy_threshold # threshold below which pyzmq will always copy messages
  36. cdef int _pid # the pid of the process which created me (for fork safety)
  37. cdef void _c_close(self) # underlying close of zmq socket
  38. # cpdef methods for direct-cython access:
  39. cpdef object send(self, object data, int flags=*, copy=*, track=*)
  40. cpdef object recv(self, int flags=*, copy=*, track=*)