Giter Club home page Giter Club logo

sendto's Introduction

sendto

Build Status

unix datagrams on osx have system send buffer limits of 2048 bytes.

this module performs a posix sendto() but first sets socket option SO_SNDBUF, raising the send limit size up to the size of whatever node buffer you pass.

npm i sendto
node -e "require('sendto')('/tmp/a', Buffer('hello'))"

sendto(string, buffer)

pass a unix datagram socket path and then the buffer, something like:

const sendto = require('sendto')
const str = 'some buffer bigger than this'
sendto('/tmp/mysocketpath', Buffer(str) )

special note on sendto(str, Buffer). there are two ways to interrupt or force node process to exit:

  • not giving node buffer

  • to an addressable sockname on recv side (bind the recv() first before sendto())

my ideas on that:

implicit coercion seems to be preferred by JavaScript over type checking, i.e. convert input to a buffer for the user. And where there's no socket address, we should probably back-off and retry to send later. Or emit JavaScript error event about the missing addressable path. Probably overkill to do a JS error, since the native perror() call already does some descriptive noise about it, though less catchable in JS

sendto's People

Contributors

reqshark avatar

Stargazers

Michael Corrado avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

gaybro8777

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.