Search:

Type: Posts; User: liri

Search: Search took 0.00 seconds.

  1. Replies
    4
    Views
    3,582

    solved

    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...
  2. Replies
    4
    Views
    3,582

    continous client read/write

    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
  3. Replies
    4
    Views
    3,582

    constantly reading and writing to a tcp server

    continually sending commands and writing commands to a tcp server.
    is the following code faulty:

    after connection was successful:



    while(1) {

    ret = write(sock,...
  4. Replies
    3
    Views
    2,388

    any ideas?

    or suggestions or this issue?
    it seems that the connect() call itself within the while(1) loop fails for some reason.
  5. Replies
    3
    Views
    2,388

    code...

    ofcourse.




    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
  6. Replies
    3
    Views
    2,388

    connecting to server with wrong port

    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...
  7. intercepting packets for web servers and replying back

    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...
  8. Replies
    7
    Views
    7,621

    Well, I'm talking about converting this form to...

    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...
  9. Replies
    7
    Views
    7,621

    thanks for the reply

    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...
  10. Replies
    7
    Views
    7,621

    difference between char *var and char var[]

    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 =...
  11. Replies
    11
    Views
    16,117

    how about this: strncpy(cmd, cmd1,...

    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"); ...
  12. Replies
    11
    Views
    16,117

    thanks. I'm not sure exactly how much memory to...

    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...
  13. Replies
    11
    Views
    16,117

    concatenating strings?

    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...
Results 1 to 13 of 13