I figured out this wasn't actually an issue with the code.
The bash script which echo'ed back the string also included the \n char
which made some mess on the read buffer.
Anyway, thanks for...
Type: Posts; User: liri
I figured out this wasn't actually an issue with the code.
The bash script which echo'ed back the string also included the \n char
which made some mess on the read buffer.
Anyway, thanks for...
That was the client code.
The server is basically a netcat tcp server which spawns a bash script:
#!/bin/bash
while read cmd
do
echo $cmd
done
continually sending commands and writing commands to a tcp server.
is the following code faulty:
after connection was successful:
while(1) {
ret = write(sock,...
or suggestions or this issue?
it seems that the connect() call itself within the while(1) loop fails for some reason.
ofcourse.
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
hey,
I'm trying to mimic the process of a proxy.
I setup a socket for the listening server first, do a bind and then listen, and
on the while loop I do accept, after the accept I setup another...
hi,
I was wondering how to approach a program which will run on server which is the default gateway and will process all packets that arrive on tcp transport with destination port 80 (which are...
Well, I'm talking about converting this form to character array:
char *var = "test";
...code...
var = "";
so doing that with strcpy(var, "") seems like the normal way of doing it.
unless you...
if choosing to work with the case of char var[] and doing
char var[] = "test"
// and then wanting to zero the variable like var = "" which is not appropriate for [] but rather // for the pointer...
Hey,
If I'm not mistaken it is possible to specify both ways and they are identical
although is this valid for assignments of variables later?
for example:
char var[] = "test";
var =...
how about this:
strncpy(cmd, cmd1, strlen(cmd1));
strncat(cmd, argv[0], strlen(argv[0]);
strcat(cmd, " ");
strncat(cmd, argv[1], strlen(argv[1]);
strcat(cmd, "\0"); ...
thanks.
I'm not sure exactly how much memory to allocate and I'm aware of
security issues that could occur with that so I looked up strcpy and
maybe I should use strncpy?
I thought of...
hey everyone,
I have some strings in argv that I need to concatenate to another
string, for example:
// argv[0] = "1"
// argv[1] = "2"
char *cmd = "ls"
*cmd after concatenating will be...