tcp

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example
ping := NewPing(nil)

addrHTTP, _ := net.ResolveTCPAddr("tcp", "example.com:80")
addrHTTPS, _ := net.ResolveTCPAddr("tcp", "example.com:443")

addrArr := []*net.TCPAddr{addrHTTP, addrHTTPS}
for _, addr := range addrArr {
	duration, err := ping.Touch(addr, time.Second*2)
	if err != nil {
		log.Fatalf("touch %s error, %s", addr.String(), err)
	}
	log.Printf("touch %s in %+v", addr.String(), duration)
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TPing

type TPing struct {
}

TPing provide ability to connect to tcp port

func NewPing

func NewPing(stop chan bool) *TPing

NewPing for tcp

func (*TPing) Touch

func (p *TPing) Touch(addr *net.TCPAddr, timeout time.Duration) (time.Duration, error)

Touch a tcp addr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL