The R Project SVN R

Rev

Rev 75890 | Rev 78466 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75890 Rev 76974
Line 199... Line 199...
199
SEXP Rsockconnect(SEXP sport, SEXP shost)
199
SEXP Rsockconnect(SEXP sport, SEXP shost)
200
{
200
{
201
    if (length(sport) != 1) error("invalid 'socket' argument");
201
    if (length(sport) != 1) error("invalid 'socket' argument");
202
    int port = asInteger(sport);
202
    int port = asInteger(sport);
203
    char *host[1];
203
    char *host[1];
204
    host[0] = (char *) translateChar(STRING_ELT(shost, 0));
204
    host[0] = (char *) translateCharFP(STRING_ELT(shost, 0));
205
    if(!initialized) internet_Init();
205
    if(!initialized) internet_Init();
206
    if(initialized > 0)
206
    if(initialized > 0)
207
	(*ptr->sockconnect)(&port, host);
207
	(*ptr->sockconnect)(&port, host);
208
    else
208
    else
209
	error(_("socket routines cannot be loaded"));
209
	error(_("socket routines cannot be loaded"));
Line 276... Line 276...
276
 
276
 
277
SEXP Rsockwrite(SEXP ssock, SEXP sstring)
277
SEXP Rsockwrite(SEXP ssock, SEXP sstring)
278
{
278
{
279
    if (length(ssock) != 1) error("invalid 'socket' argument");
279
    if (length(ssock) != 1) error("invalid 'socket' argument");
280
    int sock = asInteger(ssock), start = 0, end, len;
280
    int sock = asInteger(ssock), start = 0, end, len;
281
    char *buf = (char *) translateChar(STRING_ELT(sstring, 0)), *abuf[1];
281
    char *buf = (char *) translateCharFP(STRING_ELT(sstring, 0)), *abuf[1];
282
    end = len = (int) strlen(buf);
282
    end = len = (int) strlen(buf);
283
    abuf[0] = buf;
283
    abuf[0] = buf;
284
    if(!initialized) internet_Init();
284
    if(!initialized) internet_Init();
285
    if(initialized > 0)
285
    if(initialized > 0)
286
	(*ptr->sockwrite)(&sock, abuf, &start, &end, &len);
286
	(*ptr->sockwrite)(&sock, abuf, &start, &end, &len);