Skip to content

Commit

Permalink
fix(serve): use 127.0.0.1 to attempt connections (#3476)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdlabo authored and imhoffd committed Aug 3, 2018
1 parent 4f17af3 commit 12c3f35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@ionic/cli-framework/src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export function isPortAvailableForHost(host: string, port: number): Promise<bool
export async function isHostConnectable(host: string, port: number, { timeout }: { timeout?: number; } = {}): Promise<boolean> {
const tryConnect = async () => {
return new Promise<boolean>((resolve, reject) => {
if (host === '0.0.0.0') {
host = '127.0.0.1';
}

const sock = net.connect({ port, host });

sock.on('connect', () => {
Expand Down

0 comments on commit 12c3f35

Please sign in to comment.