Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

:RAWSOCK failures on WinXP

Help
2009-06-19
2013-05-29
  • Whenever I try to use raw sockets on WinXP, I get this message:

    *** - Win32 error 10014: The system detected an invalid pointer address in attempting to use a pointer argument in a call.

    For instance, with these test statements, as soon as I try either the 'bind' or the 'sendto':

    (use-package 'rawsock)

    (defvar sock nil)
    (defvar from-addr nil)
    (defvar to-addr nil)
    (defparameter message (make-array 100 :element-type '(unsigned-byte 8) :initial-element 45))

    (setq sock (socket :INET :DGRAM :IPPROTO-UDP))
    (setq from-addr (make-sockaddr :INET '(10 80 100 68)))
    (setq to-addr (make-sockaddr :INET '(10 80 100 175)))

    (bind sock from-addr)
    (sendto sock message to-addr)

    Also - I'm not finding a way to put the port number in the address...

    Anybody have advice, much appreciated - I'm trying to get a script going at work that will control some equipment via UPD messages.  Currenly I'm using another CL on Linux, but I need to deploy on WinXP...  So far I'm using CLISP for everything on WinXP.

     
    • Sam Steingold
      Sam Steingold
      2009-06-19

      your make-sockaddr calls are wrong.
      they should include both IP address and port.
      see modules/rawsock/test.tst for examples.

       
    • Wow - thanks!

      By running some of the defun's in that code, I found that I could make an address:

      (setq to-addr (make-sockaddr :INET '(19 136 10 80 100 175 0 0 0 0 0 0 0 0)))

      and that works.  (19 times 256 plus 136 equals 5000, the port number I want, then the IP address, then 8 zeros.)

      Never would've got that without your help!