Search:

Type: Posts; User: karas

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    2,802

    That's because client_address is casted into...

    That's because client_address is casted into (struct sockaddr*). I get the same issue no matter if I put


    socklen_t client_address_len = sizeof(struct sockaddr);
    client_sock =...
  2. Replies
    2
    Views
    2,802

    accept() and WSAEFAULT

    Hi,
    I am trying to make an echo server under Windows similar as one under Linux.



    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <winsock2.h>
    #include <ws2tcpip.h>
  3. fork() makes a copy of the calling process. Here...

    fork() makes a copy of the calling process. Here is an example of the server which accepts clients and process them in a separate process (created by forking).



    /*

    server_forked.c...
  4. You can fork process for each accepted client,...

    You can fork process for each accepted client, you can use threads for each client or you can use multiplexing. For the start, you should read tutorial at Beej's Guide to Network Programming. There,...
  5. Replies
    0
    Views
    1,661

    accept() within FreeBSD 8

    I have a dummy multiplexed server (which echoes requests) working under Linux just fine. I'm testing it on FreeBSD 8.0 and I have a strange behavior. When I use


    int client_fd = accept(server_fd,...
  6. Replies
    4
    Views
    2,664

    Beej's Guide to Network Programming...

    Beej's Guide to Network Programming is good for the start.
  7. Replies
    15
    Views
    1,594

    Poco (POCO C++ Libraries > Info > About...

    Poco (POCO C++ Libraries > Info > About) also has socket classes and it is under Boost license. Documentation and examples are quite good.
  8. Thread: Unix sockets

    by karas
    Replies
    8
    Views
    4,316

    Thanks, that's what I needed to know.

    Thanks, that's what I needed to know.
  9. Thread: Unix sockets

    by karas
    Replies
    8
    Views
    4,316

    Ok, and why SIGPIPE is raised with Unix sockets...

    Ok, and why SIGPIPE is raised with Unix sockets and not with Internet sockets? When I use Internet sockets, there's no need for server to catch this signal, only check when recv() returns 0.
  10. Thread: Unix sockets

    by karas
    Replies
    8
    Views
    4,316

    Any suggestion how to put timeout into server?

    Any suggestion how to put timeout into server?
  11. Thread: Unix sockets

    by karas
    Replies
    8
    Views
    4,316

    Hm, that could be solution, but question still...

    Hm, that could be solution, but question still remains: why Internet server knows that client interrupted and does not have broken pipe, but Unix server cannot figure it out and receives broken pipe?...
  12. Thread: Unix sockets

    by karas
    Replies
    8
    Views
    4,316

    Unix sockets

    Hi,
    I'm experimenting with Unix sockets, and I have a problem when client interrupts connection (with Ctrl-C for example).
    Server accepts connections and each client is treated in forked process...
  13. Thread: getnameinfo()

    by karas
    Replies
    2
    Views
    21,562

    Thanks, that was the problem. Here's the code...

    Thanks, that was the problem. Here's the code which works:


    #include <arpa/inet.h>
    #include <netdb.h>

    int main()
    {
    struct sockaddr_in sa;
    sa.sin_family = AF_INET;
  14. Thread: getnameinfo()

    by karas
    Replies
    2
    Views
    21,562

    getnameinfo()

    Hi,
    as I understand, getnameinfo() is used for reverse lookup i.e. to get hostname from the IP address. So, what's wrong with the following code


    #include <arpa/inet.h>
    #include <netdb.h>
    ...
  15. Replies
    2
    Views
    10,931

    It works, thanks.

    It works, thanks.
  16. Replies
    2
    Views
    10,931

    Getting service port with getservbyname()

    Hi,
    the following code


    int main()
    {
    struct servent* se = getservbyname("telnet", "tcp");
    printf("%d\n", se->s_port);
    }
  17. Replies
    3
    Views
    3,878

    Two last commands compile files into executables,...

    Two last commands compile files into executables, if you noticed.
  18. Thread: Makefile Help

    by karas
    Replies
    3
    Views
    1,597

    That's because you're using spaces instead of...

    That's because you're using spaces instead of tabs in lines where command has to be executed. For example


    $(CC) $(CFLAGS) $(OBJECTS) -o $(PROGNAME)

    must be indented with tab not with...
  19. Replies
    3
    Views
    3,878

    I compiled successfully from command line with ...

    I compiled successfully from command line with


    gcc -c *.c
    gcc myshell.c
    gcc tablegen.c
  20. Replies
    4
    Views
    3,433

    g++ client.cpp -o client g++ server.cpp -o...

    g++ client.cpp -o client
    g++ server.cpp -o server -lpthread

    compiles client and server. Beside standard library you need only thread library which is probably installed during Linux installation.
  21. Replies
    4
    Views
    3,433

    Thanks.

    Thanks.
  22. Replies
    4
    Views
    3,433

    Sockets and threads

    Hi,
    I made some tests with passing sockets to the threads and there's a problem with the following code.
    First, here's the client who's connecting to the server. It sends 1000 times a number to the...
  23. Replies
    6
    Views
    1,349

    Yes. The first one is dynamic allocating (so...

    Yes. The first one is dynamic allocating (so called heap memory) and requires deleting after use. Otherwise it will produce a memory leek. The second one is freed automatically and the reserved...
  24. Replies
    3
    Views
    1,371

    Found: xmlReadDoc() should be used instead of...

    Found: xmlReadDoc() should be used instead of xmlParseDoc() and the option for suppressing can be specified as last argument.
  25. Replies
    3
    Views
    1,371

    libxml prints errors on the screen

    If some error occurs during parsing the XML document (stored in file or RAM), the library function that caused error (xmlParseFile() or xmlParseDoc()) prints the errors on the stdout. Is there a way...
Results 1 to 25 of 78
Page 1 of 4 1 2 3 4