* Re: Netwoking examples..
2000-05-04 23:06 Netwoking examples Ravi Chamarty
@ 2000-05-05 8:20 ` Michel Quercia
2000-05-05 19:39 ` Charles Neveu
2000-05-05 8:39 ` Daniel de Rauglaudre
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Michel Quercia @ 2000-05-05 8:20 UTC (permalink / raw)
To: caml-list
> Can anyone give me a pointer to a few networking examples in
> OCaml using sockets and connects ??
If you can read French this paper might help you :
http://pauillac.inria.fr/~quercia/communication.tar.gz
(parallel computation with network examples in Ocaml)
--
Michel Quercia
23 rue de Montchapet, 21000 Dijon
http://pauillac.inria.fr/~quercia
mailto:quercia@cal.enst.fr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Netwoking examples..
2000-05-04 23:06 Netwoking examples Ravi Chamarty
2000-05-05 8:20 ` Michel Quercia
@ 2000-05-05 8:39 ` Daniel de Rauglaudre
2000-05-05 11:16 ` David Mentré
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Daniel de Rauglaudre @ 2000-05-05 8:39 UTC (permalink / raw)
To: Ravi Chamarty; +Cc: caml-list
Hello,
On Thu, May 04, 2000 at 06:06:29PM -0500, Ravi Chamarty wrote:
> Can anyone give me a pointer to a few networking examples in
> OCaml using sockets and connects ??
Wserver to create an elementary Web server:
ftp://ftp.inria.fr/INRIA/Projects/cristal/Daniel.de_Rauglaudre/Tools/
--
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Netwoking examples..
2000-05-04 23:06 Netwoking examples Ravi Chamarty
2000-05-05 8:20 ` Michel Quercia
2000-05-05 8:39 ` Daniel de Rauglaudre
@ 2000-05-05 11:16 ` David Mentré
2000-05-05 13:00 ` Benjamin C. Pierce
2000-05-05 17:29 ` tyler
4 siblings, 0 replies; 7+ messages in thread
From: David Mentré @ 2000-05-05 11:16 UTC (permalink / raw)
To: Ravi Chamarty; +Cc: caml-list
Ravi Chamarty <ravi@ittc.ukans.edu> writes:
> Can anyone give me a pointer to a few networking examples in
> OCaml using sockets and connects ??
HTML version of the OCaml book spoken about in this mailing list, more
specifically:
Client-server:
http://www.pps.jussieu.fr/Livres/ora/DA-OCAML/book-ora188.html
The explanations are in french, but the code should be easily readable.
Otherwise, look at code available in the hump, more specifically:
Distributed computing and message passing interfaces
http://caml.inria.fr/hump.html#distrib
Web tools and libraries
http://caml.inria.fr/hump.html#web
Hope it helps,
Best regards,
david
--
David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/
Opinions expressed here are only mine.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Netwoking examples..
2000-05-04 23:06 Netwoking examples Ravi Chamarty
` (2 preceding siblings ...)
2000-05-05 11:16 ` David Mentré
@ 2000-05-05 13:00 ` Benjamin C. Pierce
2000-05-05 17:29 ` tyler
4 siblings, 0 replies; 7+ messages in thread
From: Benjamin C. Pierce @ 2000-05-05 13:00 UTC (permalink / raw)
To: Ravi Chamarty; +Cc: caml-list
> Can anyone give me a pointer to a few networking examples in
> OCaml using sockets and connects ??
Unison uses sockets plus ocaml's marshalling feature to implement its
own remote procedure call mechanism. The code is a bit complex, since
it handles propagation of exceptions, etc., across address spaces,
bidirectional RPC, etc., but it's fairly well modularized.
http://www.cis.upenn.edu/~bcpierce/unison
-- B
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Netwoking examples..
2000-05-04 23:06 Netwoking examples Ravi Chamarty
` (3 preceding siblings ...)
2000-05-05 13:00 ` Benjamin C. Pierce
@ 2000-05-05 17:29 ` tyler
4 siblings, 0 replies; 7+ messages in thread
From: tyler @ 2000-05-05 17:29 UTC (permalink / raw)
To: Ravi Chamarty; +Cc: caml-list
Hey,
These are two very short programs I hacked up that worked when I tried
them.
Here's a server:
open Unix
let _ =
let this_socket = (Unix.socket PF_INET SOCK_STREAM 0) in
let this_socket_addr =
ADDR_INET ((Unix.inet_addr_of_string "127.0.0.1"), 60648) in
Unix.bind this_socket this_socket_addr;
Unix.listen this_socket 3;
let (client_socket, client_addr) = Unix.accept this_socket in
let this_string = String.create 100 in
let number_read = Unix.read client_socket this_string 0 100 in
let number_written = Unix.write client_socket this_string 0 number_read
in
Unix.close this_socket;
exit 0
;;
Here's a client:
open Unix
let _ =
let this_socket = (Unix.socket PF_INET SOCK_STREAM 0) in
let server_addr =
ADDR_INET ((Unix.inet_addr_of_string "127.0.0.1"), 60648) in
Unix.connect this_socket server_addr;
let num_written = Unix.write this_socket "hello world" 0 11 in
let response_string = String.create 20 in
let num_read = Unix.read this_socket response_string 0 20 in
print_string response_string;
Unix.close this_socket;
exit 0
;;
Compile them, start up the server program, and then run the client
program. It should print out "hello world".
Again, it's way simple, but it should hopefully give you some ideas. For a
server, make the socket, then bind it to an address, then have it listen
on a port, then have it accept a connection. When you're done, close the
socket (is there an ocaml function for flushing a file descriptor, not an
out_channel?). For a client, just make the socket and tell it where to
connect to. Its own address and port are handled automatically. You might
want to look around for a socket tutorial in c (I've seen one somewhere
before...). If you understand what's happening on both ends, it's a
question of syntax at that point. Have fun!
tyler
On Thu, 4 May 2000, Ravi Chamarty wrote:
>
> Hi,
>
> Can anyone give me a pointer to a few networking examples in
> OCaml using sockets and connects ??
>
>
> Thanks,
> Ravi
> ----------------------------------------------------------
> Ravi S Chamarty E-mail: ravi@ittc.ukans.edu
> Graduate Research Assistant, Voice :785-864-7799
> ITTC,2291 Irving Hill Road,
> University of Kansas,
> Lawrence KS 66044-7541
>
^ permalink raw reply [flat|nested] 7+ messages in thread