Giter Site home page Giter Site logo

net-socket's Introduction

SWUbanner

net-socket's People

Contributors

mrose17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

homespun clvlabs

net-socket's Issues

net.Socket is not a constructor

Below is the client code I am using to connect to the socket. It gives me a error net.socket is not a constructor.

[var net = require('net-socket');
var SocketService = (function () {
    function SocketService() {
    }
    SocketService.prototype.startDevice = function () {
        var socket = net.connect(5555, 'localhost');
        socket.setEncoding('utf8');
        socket.on('connect', function () {
            socket.end('[START]');
            socket.destroy();
        });
    };
    return SocketService;
}());](url)

image

image

Any reason why this is happening.

Unable to resolve module 'net'

Hi, I got this error
error: Error: Unable to resolve module 'net' from 'node_modules\net-socket\index.js': net could not be found within the project.
Then I tried to install 'net' manually ( assuming this to be the needed package : https://www.npmjs.com/package/net )
but I got another error:
undefined is not a constructor(evaluating 'new net.Socket(options)')

Here is my react-native code:

import React, { Component } from 'react';
import {  StyleSheet, Text, View, TouchableOpacity } from 'react-native';
const net = require('net-socket');

export default class App extends Component {

  _connect = () => {
    console.log("connecting");
    socket = net.connect(80, '192.168.1.107');
 
    socket.setEncoding('utf8');
    socket.on('connect', function () {
        // connected
        
        socket.end('message');
        socket.destroy();
    });
  }

  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity
          style={styles.button}
          onPress={this._connect}
        >
          <Text style={styles.text}>connect</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

Am I doing something wrong?

backoff not applied

Line 77:
delay *= backoff;
is never reached, as it follows a return statement

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.