Need help with KSOCKET?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

205 Stars 78 Forks MIT License 7 Commits 4 Opened issues


KSOCKET provides a very basic example how to make a network connections in the Windows Driver by using WSK

Services available


Need anything else?

Contributors list

# 40,039
7 commits


KSOCKET provides a very basic example on how to make a network connections in the Windows Driver by using WSK.


In my opinion there aren't too much examples on WSK on the Internet. This is quite understandable, as generally dealing with networking in the kernel-mode isn't a very good idea. However, sometimes, you're just too interested how it can be done.

What does it do?

It makes a HTTP GET request to the
and prints the response to the debugger. Then, it creates a TCP server listening on port 9095 and waits for a client. When the client connects, it waits for a single message, prints it to the debugger and then responds with
Hello from WSK!
and closes both client and server sockets.

The output in the debugger might look like this:



Because everyone is familiar with the Berkeley socket API, I've ported a very small subset of it - enough to make a basic TCP/UDP client/server:

int getaddrinfo(const char* node, const char* service, const struct addrinfo* hints, struct addrinfo** res);
void freeaddrinfo(struct addrinfo *res);

int socket_connection(int domain, int type, int protocol); int socket_listen(int domain, int type, int protocol); int socket_datagram(int domain, int type, int protocol); int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen); int listen(int sockfd, int backlog); int bind(int sockfd, const struct sockaddr addr, socklen_t addrlen); int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); int send(int sockfd, const void buf, size_t len, int flags); int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr dest_addr, socklen_t addrlen); int recv(int sockfd, void buf, size_t len, int flags); int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); int closesocket(int sockfd);

You can probably see the biggest difference between this API and the original Berkeley socket API - instead of a single

function, there are
functions. This is because in WSK, you have to specify type of the socket when the socket object is created. Although it would probably be possible with some workarounds to make just single
function, for simplicity of the implementation I've decided to split it too.

NOTE: This project is purely experimental and its goal is to show basic usage of the WSK. There aren't many error checks and it is not recommended for production use.


This software is open-source under the MIT license. See the LICENSE.txt file in this repository.

Dependencies are licensed by their own licenses.

If you find this project interesting, you can buy me a coffee

  BTC 3GwZMNGvLCZMi7mjL8K6iyj6qGbhkVMNMF
  LTC MQn5YC7bZd4KSsaj8snSg4TetmdKDkeCYk

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.