-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowshelp wanted
Milestone
Description
by jikai507:
My code is:
package main
import (
. "fmt"
"syscall"
)
func MAKEWORD(low, high uint8) uint32 {
var ret uint16 = uint16(high)<<8 + uint16(low)
return uint32(ret)
}
func main() {
var (
sock syscall.Handle
addr syscall.SockaddrInet4
wsadata syscall.WSAData
err error
)
err = syscall.WSAStartup(MAKEWORD(2, 2), &wsadata)
if err != nil {
Println("Startup error")
return
}
defer syscall.WSACleanup()
sock, err = syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_IP)
if err != nil {
Println("Socket error")
return
}
defer syscall.Closesocket(sock)
addr.Addr[0] = 61
addr.Addr[1] = 135
addr.Addr[2] = 169
addr.Addr[3] = 125
addr.Port = 80
err = syscall.Connect(sock, &addr)
if err != nil {
Println("Connect error")
return
}
err = syscall.Sendto(sock, []byte("hello"), 0, &addr) /////Here has some trouble
if err != nil {
Println("Send error")
} else {
Println("Send success")
}
}
It can compile well but the output is "Send error", so may the problem happen
in the the call of syscall.Sendto(...)
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1.
2.
3.
What is the expected output?
What do you see instead?
Which compiler are you using (5g, 6g, 8g, gccgo)?
Which operating system are you using?
Windows
Which version are you using? (run 'go version')
go v1.2
Please provide any additional information below.Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowshelp wanted