Exemplo n.º 1
0
void setUser(char *ip, char *millis)
/* Set user current delay. */
{
int socket = netMustConnect(host, port);
char buf[256];
safef(buf, sizeof(buf), "?set %s %s", ip, millis);
netSendString(socket, buf);
close(socket);
}
Exemplo n.º 2
0
void serverStatus()
/* Send status message to server and print result. */
{
int sd = netMustConnect(host, port);
FILE *f;
netSendString(sd, "status");
f = netFileFromSocket(sd);
copyOpenFile(f, stdout);
}
int botDelayTime(char *host, int port, char *botCheckString)
/* Figure out suggested delay time for ip address in
 * milliseconds. */
{
int sd = netMustConnect(host, port);
char buf[256];
netSendString(sd, botCheckString);
netRecieveString(sd, buf);
close(sd);
return atoi(buf);
}
static void blatzClient(char *input, char *output)
/* Send query message and dna to server and print result. */
{
struct dnaLoad *dl = dnaLoadOpen(input);
struct dnaSeq *seq;
FILE *f = mustOpen(output, "w");
static struct optionSpec options[] = {
   BZP_CLIENT_OPTIONS
};
int i;
while ((seq = dnaLoadNext(dl)) != NULL)
    {
    /* Connect */
    int sd = netMustConnect(host, port);
    FILE *sf = NULL;

    /* Send query command. */
    netSendString(sd, "query");

    /* Send options. */
    for (i=0; i<ArraySize(options); ++i)
        sendOption(sd, options[i].name);

    /* Send sequence. */
    if (optionExists("rna") || optionExists("unmask"))
        toUpperN(seq->dna, seq->size);
    else
	{
	if (seqIsLower(seq))
	    warn("Sequence %s is all lower case, and thus ignored. Use -unmask "
	         "flag to unmask lower case sequence.", seq->name);
	}
    netSendString(sd, "seq");
    netSendString(sd, seq->name);
    netSendHugeString(sd, seq->dna);
    verbose(1, "%s\n", seq->name);
    dnaSeqFree(&seq);

    /* Get and save response. */
    sf = netFileFromSocket(sd);
    copyOpenFile(sf, f);
    carefulClose(&sf);

    /* Close connection */
    close(sd);
    }
dnaLoadClose(&dl);
carefulClose(&f);
}
Exemplo n.º 5
0
void listAll()
/* Ask server for info on all IP addresses. */
{
int socket = netMustConnect(host, port);
char buf[256], *s;
netSendString(socket, "?");
for (;;)
    {
    s = netGetString(socket, buf);
    if (s == NULL || s[0] == 0)
        break;
    printf("%s\n", buf);
    }
close(socket);
}
Exemplo n.º 6
0
void queryServer(char *ip, int count)
/* Query bottleneck server - just for testing.
 * Main query is over ip port. */
{
int i;
for (i=0; i<count; ++i)
    {
    int socket = netMustConnect(host, port);
    char buf[256], *s;
    netSendString(socket, ip);
    s = netGetString(socket, buf);
    if (s == NULL)
        errAbort("Shut out by bottleneck server %s:%d", host, port);
    printf("%s millisecond delay recommended\n", s);
    close(socket);
    }
}
Exemplo n.º 7
0
void serverStop()
/* Send stop message to server. */
{
int sd = netMustConnect(host, port);
netSendString(sd, "stop");
}