Low-level socket programming including BSD sockets, Winsock, and network byte manipulation
Provides low-level socket programming for custom game networking, including BSD sockets, Winsock, and byte manipulation. Use this when building game servers or network protocols that require direct socket control instead of high-level libraries.
/plugin marketplace add pluginagentmarketplace/custom-plugin-server-side-game-dev/plugin install server-side-game-dev-plugin@pluginagentmarketplace-game-serverThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/socket-options.yamlreferences/GUIDE.mdreferences/SOCKET_GUIDE.mdscripts/helper.pyscripts/udp_server.pyMaster low-level socket programming for custom game networking.
| Type | Protocol | Use Case |
|---|---|---|
| SOCK_STREAM | TCP | Reliable data |
| SOCK_DGRAM | UDP | Real-time |
| SOCK_RAW | Raw IP | Custom protocols |
#include <sys/socket.h>
#include <netinet/in.h>
int create_game_server(int port) {
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
struct sockaddr_in addr = {
.sin_family = AF_INET,
.sin_port = htons(port),
.sin_addr.s_addr = INADDR_ANY
};
bind(sockfd, (struct sockaddr*)&addr, sizeof(addr));
fcntl(sockfd, F_SETFL, O_NONBLOCK);
return sockfd;
}
// Disable Nagle (reduce latency)
int flag = 1;
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag));
// Enable address reuse
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag));
// Set buffer size
int bufsize = 65536;
setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize));
// Network byte order
uint16_t port_net = htons(8080);
uint32_t ip_net = htonl(ip_host);
// Host byte order
uint16_t port_host = ntohs(port_net);
| Feature | BSD | Winsock |
|---|---|---|
| Init | None | WSAStartup() |
| Close | close() | closesocket() |
| Error | errno | WSAGetLastError() |
| Non-block | fcntl() | ioctlsocket() |
| Error | Root Cause | Solution |
|---|---|---|
| EADDRINUSE | Port in use | SO_REUSEADDR |
| ECONNRESET | Peer closed | Handle gracefully |
| EMFILE | Too many fds | Increase ulimit |
| High latency | Nagle | TCP_NODELAY |
# Check listening sockets
netstat -tlnp | grep game-server
# Trace syscalls
strace -e socket,bind,connect ./game-server
# Monitor traffic
tcpdump -i lo port 8080
void test_socket_creation() {
int fd = create_game_server(8080);
assert(fd >= 0);
struct sockaddr_in addr;
socklen_t len = sizeof(addr);
getsockname(fd, (struct sockaddr*)&addr, &len);
assert(ntohs(addr.sin_port) == 8080);
close(fd);
}
assets/ - Socket templatesreferences/ - Platform guidesThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.