AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
accept (ServerSocket ss [, Dictionary init]) yoix.net
 
Waits for the next client to connect to ss and returns a socket that can be used to communicate with that client, or NULL if accept timed out, was interrupted, or encountered any other kind of error. The optional init argument can be used to initialize fields in the Socket that accept returns.
 
 Example:   The following program,
import yoix.*.*;

Socket client;
ServerSocket ss = {
    int localport = 8888;
};

func(arg) {
    printf("Called func: client=%O\n", arg);
}

do {
    printf("accepting connections on %d\n", ss.localport);
    if ((client = accept(ss)) != NULL) {
        Thread handler;
        handler.queue(func, client);
    }
} while (ss.alive);
does not do any useful work, but it runs and you can easily verify (e.g., by using telnet) that it really does start a new thread that executes function func whenever a client connects to port 8888. See the Socket documentation for another example.
 
 Return:   Socket
 
 See Also:   DatagramSocket, MulticastSocket, receive, send, ServerSocket, Socket

 

Yoix is a registered trademark of AT&T Inc.