EzDevInfo.com

loopback

LoopBack is an open source Node.js framework built on top of Express optimized for building APIs for mobile, web, and other devices. Connect to multiple data sources, write business logic in Node.js, glue on top of your existing services and data, connect using JS, iOS & Android SDKs. LoopBack

Performance: TCP loopback connection vs Unix Domain Socket

Working on an Android and iOS based application which require communication with a server running in the same device. Currently using TCP loopback connection for communicating with App and Server (App written in user layer, server written in C++ using Android NDK)

I was wondering if replacing inter communcation with Unix Domain socket would improve the performance?

Or in-general is there any evidence/theory that proves that Unix Domain socket would give better performance then TCP loopback connection?

Many Thanks in advance.


Source: (StackOverflow)

RawCap error:"Unable to enter promiscuous mode (RCVALL_ON), using RCVALL_SOCKETLEVELONLY."

I am attempting to capture localhost(loopback 127.0.0.1) TCP traffic between master-slave (server-client) programs on my PC. Wireshark cannot do this, but I understand that RawCap does.

When I try to run the program, RawCap says "Unable to enter promiscuous mode (RCVALL_ON), using RCVALL_SOCKETLEVELONLY."

Any idea what is causing this?

much thanks!


Source: (StackOverflow)

Advertisements

JMeter - Loopback address error when launching jmeter-server on Linux

I'm trying to set up a distributed load testing environment using JMeter. I need to set up the remote clients using something portable like a Linux Live CD, but whenever I attempt to launch jmeter-server in Linux, I receive the following error...

Created remote object: UnicastServerRef [liveRef: [endpoint:[127.0.0.1:49018](local),objID:[3b0d3d42:12985b7a49b:-7fff, -8459389540436649718]]]
    Server failed to start: java.rmi.RemoteException: Cannot start. testbox01.qa.nwr.lan is a loopback address.

After extensive googling, the only remedy I can find is to edit the /etc/hosts file so the hostname maps to something other than the 127.0.0.1 loopback address. I've tried this using Ubuntu, Fedora and CentOS, and apparently they all default to setting the hostname to 127.0.0.l.

The way I see it, I have four options...

1) Customize the /etc/hosts file for every remote test box I set up, which involves upwards of 20-50 dynamically DHCP-assigned IP addresses.

2) Figure out a way to force Linux itself to assign the hostname to its DHCP IP address by default. This is certainly the more graceful solution, but I have no idea how to do this. Anyone know?

3) Find and use a Linux distro available as a Live CD that doesn't map its hostname to 127.0.0.1 by default. Anyone know one?

4) Dive into JMeter's code and start yanking wires, but if it comes to this, I'd just as soon use another open source tool with a slimmer feature set, but whose distributed architecture doesn't suffer from this issue.

If anyone has any advice, I'd be grateful. Thanks!


Source: (StackOverflow)

Android Emulator loopback to IIS Express does not work, but does work with Cassini

I am attempting to post data from an Android application running in the Android Emulator on my local machine to a web application running under IIS Express also running on my local machine. Unfortunately, when I post to 10.0.2.2 from the emulator I receive a Host Not Found error message.

If I configure the web application to run under ASP.NET Dev Server (Cassini) instead of IIS Express the Android application is able to post with no problems. What configuration am I missing for IIS Express that is preventing it from working with a loopback from the Android emulator?


Source: (StackOverflow)

Loopback in Android Bluetooth

Is it possible to make a loopback Bluetooth connection in an Android phone so that one service can connect to another within the same phone (or even to itself)?

The idea is to use it so I can test a multi-player game that uses Bluetooth to communicate between players.


Source: (StackOverflow)

Microsoft Edge does not allow localhost loopback for websockets

I have web-site and desktop application, and I want to connect them by websockets. So my web-site tries to connect to wss://localhost:8080, for example.

It works in IE11, but in "MS Edge" I have an error:

Cross zone request is not allowed

I have this problem on Win10 10240, so the flag "Allow localhost loopback" is enabled by default, and it did not help.

When I use CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe" or this utility, all works as expected.

So, is this a case, that in new builds of "MS Edge" loopbacks are allowed for http, but not allowed for websockets? And if so, is it possible to make some workaround, and not to force my users to run some shell comand or to download externall utility?

Related question: Can't open localhost in Microsoft Edge (Project Spartan) in Windows 10 preview


Source: (StackOverflow)

Coding for Ethernet PHY Loopback Test

I have to write a Ethernet PHY loopback test in Linux. I've never done it before and had no clue where to start. After some researching, I came up with the plan for the test, and I wonder if anyone can help me to verify it and give me some pointers to my questions.

This is a external loopback setup. It connects the TX+/- to RX+/- pins for each internal PHY's on the Ethernet switch chip.

So the loopback high level packet path is as follow:

CPU->PHY0(chip)->Ethernet switch(chip)'s internal PHY->PHY0(chip)->CPU

For this test, I plan to

  1. configure the internal PHYs on the Ethernet switch with specific MAC addresses,
  2. pack the Ethernet test packet using CPU's MAC address as the source address and the
    MAC address configured in step 1. as the destination address,
  3. send and wait to receive the test packet,
  4. compare sent and received data pattern.

Any suggestions? Also, I wonder if there are functions in Linux that I can use to generate the packets for step 2, and send the packets for step 3.

Thank you very much.


Source: (StackOverflow)

How many loop devices can I create (and mount) on a modern Linux (2.6.30+ kernel) system?

I would like to implement per-directory quotas for a multi-user web application we're developing. The problem is... we have implemented a document manager for any client to store their own private documents but we don't want to run out of space due to this feature, so we want to assign them a given limit.

As there doesn't seem to exist a standard method for implementing per-directory quotas in Linux (I know, quotas are primarily targeted against users or groups, but we need something like the way Windows Server 2008 R2 handles quotas on a per-directory basis) I opted to use a 'trick'. I basically do this:

touch client1.ext3
dd if=/dev/zero of=./client1.ext3 bs=1024 count=16384
mkfs.ext3 ./client1.ext3
mount -o loop,rw ./client1.ext3 ./mountpoint

It's just a code sample, but that's the idea... I create virtual 'volumes' which I assign to my clients so they can store their private data and, in case they need more, they can pay on a per-storage-ammount basis.

The 'problem' I see with this is I just see 8 loop devices in my /dev hierarchy, and we currently have 17 test clients for our application, so the ammount of currently present loop devices don't cover my needs. I know you could allocate up to 256 loop devices up to kernel version 2.6.23, and the limit (from version 2.6.24 onwards) isn't theoretically present anymore, although I still have some concerns.

Honestly, I feel like filling the /dev hierarchy with 1000+ loop devices (which are not gonna be unmounted at all during all the system lifetime) is very wrong and not the way it should be done, but maybe it's doable as a middle-term solution, so my questions are:

  • How much memory does a single loop device take on allocation?
  • Do the system crash or have a performance hit having 256+ allocated loop devices?
  • Can I increase in a dynamic way the number of loop devices? or...
  • How can I pre-define the number of available loop devices at boot time?

Source: (StackOverflow)

Sending data to 127.* : Unreachable Host

I'm trying to send to the loopback address space in a .NET 3.5 application running on Windows XP. The code does a simple:

receiver = new IPEndPoint(IPAddress.Parse("127.0.0.2"), 8000);
sock.SendTo(data, len, SocketFlags.None, receiver);

When I run the code I get an unreachable host socket exception. That seems strange to me because the loopback interface is always around, and it shouldn't generate any unreachable host exceptions.

Windows 7 executes the code just fine, making the problem that much stranger.

So -- if anyone has any tips on getting this working in XP, I'd appreciate it.

EDIT:

Some info:

  • Something is listening on 127.0.0.2, my netstat shows:
  • UDP 127.0.0.2:8000 : 5824

  • I am running XP SP3, and there is no firewall on my test machine

I'm noticing on XP when I ping 127.0.0.2, the replies come back:

Reply from 127.0.0.1

On Windows 7 the reply comes back from the address I pinged:

Reply from 127.0.0.2

I'm thinking this could be the issue and as such it's not really a programming problem, it's more of a problem with XP itself...

-- Dan


Source: (StackOverflow)

Get full json struct in a belongsTo relation

I'm trying to setup a basic model relation in Loopback by creating a belongsTo relationship.

I have two models defined like this:

Contract.json

{
  "name": "Contract",
  "base": "PersistedModel",
  "idInjection": false,
  "options": {
    "validateUpsert": true
  },
  "mssql": {
    "schema": "dbo",
    "table": "Contract"
  },
  "properties": {
    "contractid": {
       // some property stuff
    },
  "validations": [],
  "relations": {
    "employee": {
      "type": "belongsTo",
      "model": "Employee",
      "foreignKey": ""
    }
  },
  "acls": [],
  "methods": []
}

Employee.json

{
  "name": "Employee",
  "base": "PersistedModel",
  "idInjection": false,
  "options": {
    "validateUpsert": true
  },
  "mssql": {
    "schema": "dbo",
    "table": "Employee"
  },
  "properties": {
    "employeeid": {
       // some property definitions...
    }
  },
  "validations": [],
  "relations": {
    "contracts": {
      "type": "hasMany",
      "model": "Contract",
      "foreignKey": ""
    }
  },
  "acls": [],
  "methods": []
}

When I do a GET request on a Contract with a specfic id I get the result:

Calling: /api/Contracts/55

{
  "contractid": 55,
  "employeeId": 83
}

Which is fine so far. But when I do a GET request on Contract, also getting the Employees I expect to get an ouput like this:

Calling: /api/Contracts/55/employee

{
  "contractid": 55,
  "employee": {
      "employeeid": 83
  }
}

But instead I'm only getting the Employee object without its Contract:

{
    "employeeid": 83
}

Why is that?

Am I doing something wrong? Or do I have the wrong expectations?


Source: (StackOverflow)

Win32 sockets - Forcing ip packets to leave physical interfaces when sending to other local interfaces

Summary: I'm trying to create sockets to pass data between two physical interfaces that exist on the same machine, and Win32 sockets always forwards the traffic directly in the kernel instead of pushing through the physical interfaces. Is there any way to disable this behavior, perhaps through device settings, registry tweaks, routing table shenanigans, or socket options? We're using Windows XP SP3.

Some background. I'm attempting to build some completely automated IP tests to exercise our custom IPv4 equipment. We have a large lab of Windows XP machines, and individual physical ethernet interfaces for each device we're connecting to. Our devices are effectively ethernet routers each with their own IPs.

We need to send data out our lab machines, through our devices, then back into the same computer. We will be sending Unicast and Multicast UDP, TCP, and broadcast IP traffic through the devices.

We want (and likely need) the traffic to originate on the same machine it is destined to. To do this, we configure two separate NICs each with their own IP on their own subnet, for instance NIC #1 with 10.0.0.1/24 and NIC #2 with 10.0.1.1/24. Our devices then act like simple passthrough routers, and have two interfaces, one on the 10.0.0.0/24 subnet, one on the 10.0.1.0/24 subnet, which they just forward packets back and forth from.

To generate our data, we'd like to be able to use Win32 sockets, since it is well-understood, well-supported, what our customers are using, and would probably be the most rapid approach. Packet injection is probably feasible for UDP and broadcast IP, but very likely not so for TCP. I'd entertain ideas that used packet injection, but would strongly prefer standard Win32 sockets.

As stated in the summary, the packets never leave the machine. I've googled like a madman and I've not found much. Any ideas?


Source: (StackOverflow)

Loopback connections not working on Windows Server 2008

I am using Windows Server 2008 R2 with IIS 7. My MVC application runs fine on asp.net 4.5 version. Note that application works fine on other servers and hosting accounts.

However, on one of the new system... only one of the function is not working and I'm getting an error trying to run another function from application by making an http call!

This works fine on other all other hosting accounts (on different server) / on shared server too and development machine. Not sure why on this new windows 2008 server with IIS its not working.

I am getting (404) Not Found error when application tries to call this URL.

If I call the function manually, it runs.. but I need to call this function in certain event by making an http call within application. This is a loopback connection originating from application to the same application but another function called at different url with parameters.

Can anyone advise what could be wrong here? And what thing we need to fix to enable loopback connections support in IIS / server?

Here is the code that is used.

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Method = "GET";
objRequest.ContentType = "application/x-www-form-urlencoded";
objRequest.AllowAutoRedirect = true;

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(AcceptAllCertifications);

Awaiting your quick response on the same.


Source: (StackOverflow)

Software serial port loopback on linux

Currently I need to develop some program that will communicate with cisco devices over serial line. I want to build testing environment on my development linux machine. So, I found dynamips cisco emulator. This emulator can provide interface via serial line with '-U /dev/ttyS0' option. Well, this causes dynamips to open hardware serial port and communicate via it. I'm able to connect to this hardware serial port from another linux machine with serial client like minicom.

However, since i'm using virtualbox for both linux machines, I link serial ports via virtualbox ability to forward serial port to named pipe. This scheme seems to be working, but very redunant. I'm looking for a method to run dynamips and minicom on a single linux machine.

I found that pseudo-terminals could be useful in my case. But I've tried to run dynamips with '-U /dev/ptmx' and then connect with minicom to created /dev/pts/... port and vice versa. In both cases I've got input/output error on both sides.


Source: (StackOverflow)

loopback network kernel module not working

I am new to kernel module development. I am trying to development a pseudo network driver operates in loopback mode without any actual device. My goal is to use the following setup:

iperf -s -u.........iperf -c 192.168.1.1 -p 5001 -u

======..............===========

|...if0....|.............|........if1.........|

======..............===========

 |              |
/|\            \|/
 |              |
  ---------------

I have registered two interface from the driver. Then I modified the UDP packet received from if1 so that it appeared as it was received at if0. But it never reaches to the iperf server application listening on all udp if's udp port. But whenever I sniffed the packet via wireshark on if0, it seems that the packet is being received at if0. But for some reason it is not going through the network stack.

any clues? Both the ip checksum & udp checksum have recalculated and verified (using wireshark). I am using netif_rx to indicate packet to the other interface handle (if0 handle).

I have only used 5 function ptr callbacks {open, close, xmit_start, get_stats & config} for network operations. Also checksum is set to UNNECESSARY. IF flag has been set to indicate NO_ARP.

EDIT: IP ADDR OUTPUT

eth1: mtu 1500 qdisc

pfifo_fast state UP qlen 1000 link/ether 00:e0:ff:00:00:e0 brd

ff:ff:ff:ff:ff:ff inet 192.168.1.1/24 brd 192.168.1.255 scope globa eth1 valid_lft

forever preferred_lft forever 4:

eth2: mtu 1500 qdisc pfifo_fast

state UP qlen 1000 link/ether 00:e0:ff:40:00:e0 brd ff:ff:ff:ff:ff:ff

inet 192.168.2.1/24 brd 192.168.2.255 scope global eth2 valid_lft

forever preferred_lft forever


Source: (StackOverflow)