Skip to content

Instantly share code, notes, and snippets.

const net = require('net');
var r = net.getaddrinfo('localhost', '', {family: net.AF_INET,
type: net.SOCK_STREAM})
var ip = r[0].address.host;
var sock = new net.Socket(net.AF_INET, net.SOCK_STREAM);
sock.connect({host: ip, port: 1234});
#!/usr/bin/env python
# coding=utf-8
# Author: Saúl Ibarra Corretgé <[email protected]>
# License: MIT
import argparse
import multiprocessing
import requests
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <uv.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <uv.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
# wait for end
while True:
peer_a_read = asyncio.async(peerA.read())
peer_a_read.other_peer = peerB
peer_b_read = asyncio.async(peerB.read())
peer_b_read.other_peer = peerA
done, pending = yield from asyncio.wait([peer_a_read, peer_b_read], return_when=asyncio.FIRST_COMPLETED)
for task in pending:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "glibuv.h"
typedef struct uv_source_s uv_source_t;
# On a aDebian system
sudo apt-get install ubuntu-archive-keyring
# Create environment
sudo pbuilder create --distribution trusty --architecture amd64 --mirror http://archive.ubuntu.com/ubuntu --debootstrapopts --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
# Enable universe
sudo pbuilder update --components "main universe" --override-config --distribution trusty --architecture amd64 --mirror http://archive.ubuntu.com/ubuntu --debootstrapopts --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
diff --git a/src/win/tcp.c b/src/win/tcp.c
index c5ddbed..e00dd03 100644
--- a/src/win/tcp.c
+++ b/src/win/tcp.c
@@ -869,7 +869,12 @@ int uv_tcp_write(uv_loop_t* loop,
}
} else {
/* Send failed due to an error. */
- return WSAGetLastError();
+ req->queued_bytes = 0;
Index: jni/opus/pj_sources/pj_opus.c
===================================================================
--- jni/opus/pj_sources/pj_opus.c (revision 2470)
+++ jni/opus/pj_sources/pj_opus.c (working copy)
@@ -666,7 +666,7 @@
unsigned char toc;
const unsigned char *raw_frames[48];
short size[48];
- int payload_offset, samples_per_frame;
+ int err, payload_offset, samples_per_frame;
Index: jni/opus/pj_sources/pj_opus.c
===================================================================
--- jni/opus/pj_sources/pj_opus.c (revision 2470)
+++ jni/opus/pj_sources/pj_opus.c (working copy)
@@ -666,7 +666,7 @@
unsigned char toc;
const unsigned char *raw_frames[48];
short size[48];
- int payload_offset, samples_per_frame;
+ int err, payload_offset, samples_per_frame;