pluginagentmarketplace/custom-plugin-server-side-game-dev · Archived

socket-programming

Low-level socket programming including BSD sockets, Winsock, and network byte manipulation

First seen Feb 17, 2026

Installation

$ npx skills add pluginagentmarketplace/custom-plugin-server-side-game-dev --skill socket-programming

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from pluginagentmarketplace/custom-plugin-server-side-game-dev.

npx skills add pluginagentmarketplace/custom-plugin-server-side-game-dev

Browse all from pluginagentmarketplace/custom-plugin-server-side-game-dev

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version2.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,279 B
  • docs SUMMARY.md 116 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

Socket Programming for Games

Master low-level socket programming for custom game networking.

Socket Types

Type Protocol Use Case
SOCK_STREAM TCP Reliable data
SOCK_DGRAM UDP Real-time
SOCK_RAW Raw IP Custom protocols

BSD Socket (C)

#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;
}

Socket Options

// 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));

Byte Order

// 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);

Platform Differences

Feature BSD Winsock
Init None WSAStartup()
Close close() closesocket()
Error errno WSAGetLastError()
Non-block fcntl() ioctlsocket()

Troubleshooting

Common Failure Modes

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

Debug Checklist

# Check listening sockets
netstat -tlnp | grep game-server

# Trace syscalls
strace -e socket,bind,connect ./game-server

# Monitor traffic
tcpdump -i lo port 8080

Unit Test Template

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);
}

Resources

  • assets/ - Socket templates
  • references/ - Platform guides