Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

UDPsocket.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* =STS=> UDPsocket.h[1733].aa07 open SMID:7 */
  2. //////////////////////////////////////////////////////////////////////
  3. //
  4. // (c) Copyright 2003 Cyberkinetics, Inc.
  5. //
  6. // $Workfile: UDPsocket.h $
  7. // $Archive: /Cerebus/WindowsApps/Central/UDPsocket.h $
  8. // $Revision: 1 $
  9. // $Date: 1/05/04 4:29p $
  10. // $Author: Kkorver $
  11. //
  12. // $NoKeywords: $
  13. //
  14. //////////////////////////////////////////////////////////////////////
  15. #ifndef UDPSOCKET_H_INCLUDED
  16. #define UDPSOCKET_H_INCLUDED
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif // _MSC_VER > 1000
  20. #ifdef WIN32
  21. #include <winsock2.h>
  22. #include <windows.h>
  23. #else
  24. #ifndef __APPLE__
  25. #include <linux/sockios.h>
  26. #endif
  27. #include <sys/socket.h>
  28. #include <netinet/in.h>
  29. #include <sys/ioctl.h>
  30. typedef struct sockaddr_in SOCKADDR_IN;
  31. typedef int SOCKET;
  32. #endif
  33. #include "cbhwlib.h"
  34. #include "cki_common.h"
  35. #define LOOPBACK_ADDRESS "127.0.0.1"
  36. #define LOOPBACK_BROADCAST "127.0.0.1"
  37. class UDPSocket
  38. {
  39. public:
  40. UDPSocket();
  41. virtual ~UDPSocket();
  42. // Open UDP socket
  43. cbRESULT Open(STARTUP_OPTIONS nStartupOptionsFlags, int nRange, bool bVerbose, LPCSTR szInIP,
  44. LPCSTR szOutIP, bool bBroadcast, bool bDontRoute, bool bNonBlocking,
  45. int nRecBufSize, int nInPort, int nOutPort, int nPacketSize);
  46. void OutPort(int nOutPort);
  47. void Close();
  48. SOCKET GetSocket() {return inst_sock;}
  49. // Receive one packet if queued
  50. int Recv(void * packet) const;
  51. // Send this packet, it has cbBytes of length
  52. int Send(void *ppkt, int cbBytes) const;
  53. protected:
  54. SOCKET inst_sock; // instrument socket for input
  55. SOCKADDR_IN dest_sockaddr;
  56. STARTUP_OPTIONS m_nStartupOptionsFlags;
  57. int m_nPacketSize; // packet size
  58. bool m_bVerbose; // verbose output
  59. };
  60. #endif // include guard