New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Berkeley sockets API, version 2 #26

merged 11 commits into from Jun 17, 2017


None yet
2 participants

ids1024 commented Jun 16, 2017

#1 can be closed now. This shouldn't be merged yet, but I thought I might as well create a PR to keep track of it.

This test program works; but some fairly important things, like hostname lookup, are still needed:

#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main() {
    int fd = socket(AF_INET, SOCK_STREAM, 0);

    struct sockaddr_in addr;
    addr.sin_family = AF_INET;
    addr.sin_port = htons(80);
    inet_aton("", &addr.sin_addr);

    connect(fd, (struct sockaddr*)&addr, sizeof(addr));
    char *req = "GET / HTTP/1.1\r\nHost:\r\nConnection: close\r\n\r\n";
    send(fd, req, strlen(req), 0);

    char c;
    while (recv(fd, &c, 1, 0) == 1)


ids1024 added some commits Jun 14, 2017

Initial implementation of gethostbyname
Some code copied from Redox's libstd backend.

@ids1024 ids1024 changed the title from [WIP] Berkeley sockets API, version 2 to Berkeley sockets API, version 2 Jun 17, 2017


This comment has been minimized.


ids1024 commented Jun 17, 2017

This can now be merged, although we may need to implement more in the future.

@jackpot51 jackpot51 merged commit e1721f5 into redox-os:redox Jun 17, 2017

@ids1024 ids1024 deleted the ids1024:sockets2 branch Aug 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment