Arc Forumnew | comments | leaders | submitlogin
3 points by akkartik 757 days ago | link | parent

I just went through this exercise as well. Once you define the server, you can then query it with this code:

    arc> (load "lib/client.arc")
    arc> (cdr (mkreq "http://localhost:8080/"))

3 points by zck 757 days ago | link

Ooh, interesting! We might want to figure out a long-term documentation system for Anarki; the existing documentation is for Arc 3.1. And while that's great, it's suboptimal for cases like this, because it says "...there is no support for outgoing network connections." (


2 points by akkartik 757 days ago | link

Yeah, there's a reason why the documentation isn't linked on the right side at :/


3 points by christianbryant 757 days ago | link

How about UDP calls? I sucked this CL snippet a while back (sorry I don't have the author info at hand). Creates a socket, sends data and receives data:

  (defun create-client (port buffer)
     (let ((socket (usocket:socket-connect "" port
  '(unsigned-byte 8))))
	   (format t "Sending data~%")
	   (replace buffer #(1 2 3 4 5 6 7 8))
	   (format t "Receiving data~%")
	   (usocket:socket-send socket buffer 8)
	   (usocket:socket-receive socket buffer 8)
	   (format t "~A~%" buffer))
      (usocket:socket-close socket))))


2 points by hjek 731 days ago | link

Check the Racket docs on UDP[0]. Arc itself is very high-level, but you can do more low-level stuff via Racket interop.