我正在尝试使用下面的代码处理Winsock_Connect事件(实际上我需要在Excel宏中使用它):
Dim Winsock1 As Winsock 'Object type definition
Sub Init()
Set Winsock1 = CreateObject("MSWinsock.Winsock") 'Object initialization
Winsock1.RemoteHost = "MyHost"
Winsock1.RemotePort = "22"
Winsock1.C
我正在使用MSWinsock库套接字创建一个C#应用程序。我设置的一切都是正确的(我有80%的把握),但每次我的shockwave/flash播放器都显示没有连接。
class Program
{
static Winsock[] winsock;
static int currentId;
static void Main(string[] args)
{
winsock = new Winsock[10000];
winsock[0] = new Winsock();
winsock[0].Bind(123
Private Sub Form_Load()
Winsock1.RemotePort = 22222
Winsock1.Protocol = sckUDPProtocol
End Sub
Private Sub Command1_Click()
Command1.Enabled = False
Dim sendBuff As String
sendBuff = "XXXXX"
Label1:
On Error GoTo Label2
Winsock1.RemoteHost = "andon-ed
我用winsock用VB6做了一个非常简单的聊天应用程序,但是你可以看到它只接受一个连接,我怎么能处理多个用户呢?谢谢!
Private Sub Winsock1_Close()
' Finaliza la conexión
Winsock1.Close
txtLog = txtLog & "*** Desconectado" & vbCrLf
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.St
我有一个简单的winsock服务器聊天,代码如下:
Private Sub Form_Load()
Winsock1.LocalPort = 5100
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsoc
我正在尝试使用CSocket在VB6中执行GET请求。数据已成功发送,但未收到响应(在多个站点上测试)。我的代码如下。
Option Explicit
Dim WithEvents WinSock As CSocket
Private Sub Form_Load()
Set WinSock = New CSocket
End Sub
Private Sub btnConnect_Click()
WinSock.Protocol = sckTCPProtocol
WinSock.Connect "winhome.de", 80
MsgBox "Connecting.
我已经在不同的论坛搜索了很长一段时间,如果可以使用winsock发送文本到不同的IP,但我找不到方法。我尝试将两个不同的winsock放在相同的形式,但第二个winsock的消息从未到达。这是我的代码:
Private Sub Form_Load()
On Error Resume Next
a = bytMsg()
wsck.RemoteHost = strNombreATMMonitor2
wsck.RemotePort = vPuertoATMMonitor2
wsck.Connect
'Conectamos el segundo
Winsock1.RemoteHost = st
我正在使用Winsock控件:
Private Sub Form_Load()
Winsock1.Connect "stackoverflow.com", 80
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "GET /questions/8624871/vb6-alternative-to-inet-webbrowser-control HTTP/1.1" & vbC
C:\Users\Chan\Desktop\test - fail\winsock2 socket server.cpp: In function `int _tmain()':
C:\Users\Chan\Desktop\test - fail\winsock2 socket server.cpp:48: error: `getaddrinfo' was not declared in this scope
C:\Users\Chan\Desktop\test - fail\winsock2 socket server.cpp:59: error: `freeaddrinfo
我打算在编程中改变我的C#风格(我一直使用'public static‘作为变量,方法-所有的东西)。
我的问题是:
public class WinSock
{
public Socket sock;
public byte[] data;
.....
}
var data = new byte[2058];
data = WinSock.data;
或者这个:
private class WinSock
{
private Socket sock;
private byte[] data;
.....
public byte
我是一个编程初学者,我被困在试图理解我的教授给我的这组代码。下面是表单的完整代码:
Option Explicit
Private Sub cmdSend_Click()
Dim sIPAddress As String
sIPAddress = Trim(txtIPAddress)
If sIPAddress = "" Then Exit Sub
With Winsock1
.RemoteHost = sIPAddress
.RemotePort = "1338"
.Sen
我目前正在创建一个脚本来实现RealTerm的自动化。我需要发送一个二进制文件,并将Winsock设置设置为"Raw“。RealTerms文档表明,该设置需要一个整数0或1,但我收到的是"object setting“"Winsock”。
RT.Winsock = 0是我目前设置的。这是我收到的错误信息。'<win32com.gen_py.Realterm Library.IRealtermIntf instance at 0x1826368502752>' object has no attribute 'Winsock',
Winsock1.Connect "mail.website.com", 110
Do Until received: DoEvents: Loop
If sckError Then MsgBox "An error occured trying to connect to server": Exit Sub
sendMsg "USER username" ' Send UserName
If sckError Then MsgBox "Error with username": Exit Sub
s
我在通过propertybag发送winsock时遇到了麻烦。我有一个客户机/服务器应用程序,它通过使用propertybag发送图像。我将propertybag转换为字节数组并尝试通过winsock发送它,然后当我将字节数组转换回propertybag时,它似乎无法读取它。看上去数据在发送时被破坏了。
客户端(发送属性包)
Dim pb As PropertyBag
Dim byt() As Byte
Set pb = New PropertyBag
pb.WriteProperty "picc", Image1.Picture
byt = pb.Contents
Wi
我正在尝试使用WinSock.h头文件,但我收到以下两个错误之一: in VS2010 (C++):
Unresolved External Symbol to [the function included in winsock.g, e.g socket()]
在gcc命令行(C)中:
Undefined Reference to [the function included in winsock.g, e.g socket()]
代码很简单:只需包含Winsock.h头文件,然后
SOCKET s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);