Winsock Send Multiple Client
dear pple,
i wrote a server program which sits in a computer and listens to an incoming connection. i have a send file function in a module. whenever a client connects, this server will send a file to this client.
so if client1 connects, server will send to client1 and if client2 conects before client1 finish receiving the file, the server should also send a file to this client2 while sending the first file to client1... meaning i need to do concurrent file transfer. can the method i described be done? i wrote a server and whenever two connections come in, the file sending part will give me some error message. something about blocking process.
how should i go about implementing concurrent file sending using winsock? the server doesn't know how many clients will connect. it should just sit and listen to incoming connections. please advice
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Winsock Send Multiple Client
dear all,
this is what i've done so far. i have one winsock to listen to an incoming connection and when any incoming connection is detected, the application will zip some files and send it out using an activeX app which i already written.
the problem is when i tried the app and used 2 client to connect to it almost simultaneously, the second client can't seem to get the file and the server gave me an error "file not found". what i guess is that the main app doesn't have enough time to zip the file? is this possible? is winsock running in a sequential manner? meaning that if the first connection comes in, it handles the first one and even if the second one comes in, it will wait until the first connection is serviced?
i called a function to zip file under the winsock_dataarrival method. can anyone help me out and tell me why? thanks
How To Send Multiple To Multiple Data Using Winsock
I have two forms client and server i run in a localhost. I want to send multiple data from client and server. but how?
My program is too big and long so I make a simple same example to you
Lets say I got String a,b,c i want to send a,b,c to the server and stored in String sa, sb,sc in the server form then send ack(acknowladgement) back to the client...ask client to send the different new data back to the server again but....the data in the server get corrupted in second time ...means it only accept b and c...it ignore the a why?
please help thanks
Code:dim a,b,c,ack as string ' in global
privete sub command_send click
a="qwe"
b="qwe"
c="qwe"
tcpclient.senddata(a)
tcpclient.senddata(b)
tcpclient.senddata(c)
end sub
dim sa,sb,sc.ack as string 'in global also
Private Sub tcpserver_DataArrival(ByVal bytesTotal As Long)
call tcpclient.getdata(sa,8,3)
call tcpclient.getdata(sb,8,3)
call tcpclient.getdata(sc,8,3)
text1.text= a & b & c
ack="received"
tcpclient.senddata(ack)
end sub
Private Sub tcpclient_DataArrival(ByVal bytesTotal As Long)
call tcpclient.getdata(ack)
a="xcx"
b="xcx"
c="xcx"
tcpclient.senddata(a)
tcpclient.senddata(b)
tcpclient.senddata(c)
end sub
Winsock Server/client Multiple Messages
Hello, i have been working with send and recieve for some time here and ive come up with a problem that just is weird. the client can send the request, name, and password with no problem. But for some reason the server gets nothing to the client.
notes:
-I traced through both progs at once and the messages did get through to client. But normal running of the program yeilds nothing.
-They are seperate programs.
SERVER CODE EXE # 1
Code:
Option Explicit
Dim Length As Integer
Dim x As Integer
Dim Flag As Byte
Dim Response As String
Dim Success As Integer 'if name & pass good then it should equel 2
Dim Request As String
Dim User As String
Dim Pass As String
Public Sub DoSleep()
Dim i As Long
Do Until i = 5000
i = i + 1
Loop
End Sub
Private Sub cmdRun_Click()
WS.Close
WS.LocalPort = txtPort
WS.Listen
status.ForeColor = vbGreen
status = "ON-LINE"
End Sub
Private Sub Form_Activate()
txtIp = WS.LocalIP
End Sub
Private Sub WS_Close()
status.ForeColor = &H808080
status = "OFF-LINE"
End Sub
Private Sub WS_ConnectionRequest(ByVal requestID As Long)
If WS.State <> sckClosed Then
WS.Close
WS.Accept requestID
End If
End Sub
Private Sub WS_DataArrival(ByVal bytesTotal As Long)
Dim Incoming As String
WS.GetData Incoming
'Toms Incoming Sorter
'====================
x = 0
Do
x = x + 1
If Mid(Incoming, x, 1) = ":" Then
Length = Len(Incoming)
If Flag = 0 Then
Request = Mid(Incoming, 1, x - 1)
Incoming = Mid(Incoming, x + 1, Length - x)
Flag = 1
x = 0
ElseIf Flag = 1 Then
User = Mid(Incoming, 1, x - 1)
Incoming = Mid(Incoming, x + 1, Length - x)
Flag = 2
x = 0
ElseIf Flag = 2 Then
Pass = Mid(Incoming, 1, x - 1)
Incoming = Mid(Incoming, x + 1, Length - x)
Flag = 0
x = 0
End If
End If
Loop Until Incoming = ""
x = 0
'=================
'End of Sorting
Select Case Request
Case "Login"
Login
End Select
If WS.State = sckConnected Then
'DoSleep
WS.SendData "~FINN~"
End If
cmdRun_Click
End Sub
Public Sub Login()
Do
'Check User Name
If User = txtName.Text Then
If WS.State = sckConnected Then
'DoSleep
WS.SendData "Name OK!"
Success = Success + 1
End If
Else
Success = 0
End If
'Check User Pass
If Pass = txtPass.Text Then
If WS.State = sckConnected Then
'DoSleep
WS.SendData "Pass OK!"
Success = Success + 1
End If
Else
Success = 0
End If
'Check if Name and pass have been clarified
If Success = 2 Then
If WS.State = sckConnected Then
'DoSleep
WS.SendData "Login Successful!"
'ADD MORE STUFF WHEN GAME IS BUILT
End If
End If
dta.Recordset.MoveNext
Loop Until dta.Recordset.EOF = True
dta.Recordset.MoveFirst
End Sub
CLIENT CODE EXE # 2
Code:
Option Explicit
Dim Message As String
Dim Request As String
Dim RequestNamePass As String
Public Sub cmdConn_Click()
WSC.Close
WSC.Protocol = sckTCPProtocol
'WSC.Connect "192.168.0.232", 21 'me or u
WSC.Connect "xxx.128.xxx.9", 21 'Tom
End Sub
Private Sub WSC_Connect()
RequestNamePass = "Login" & ":" & txtName & ":" & txtPass & ":" 'Request:User:Pass
WSC.SendData RequestNamePass
End Sub
Private Sub WSC_DataArrival(ByVal bytesTotal As Long)
Dim Message As String
WSC.GetData Message
status.Text = status.Text & vbNewLine & Message
End Sub
Send A Multi-function Command From A Client To A Server, Useing Winsock
im new to the winsock control...
i have created a server, and a client which successfully connect, and send and receive data. i want to be able to send one string of data to the server which the server can split up and use those separate strings to execute different commands.
e.g.
i want to send a (one single) string to the server which tels it to display a message box. when the string arives the server splits the string int the folloing variabls
strCMD = "1"
'the command to execute in this case a message box.
strPar1 = "Error!"
'the first parameter for the message box in this case the message box title.
strPar2 = "This is a message from the client!"
'the second Parameter for the message box, in this case, the message to be displayed.
strPar3 = "4096"
' the type of message box to be displayed, in this case system modal.
i have developed ways of acheiving this but they are unreliable and constantly cause errors. if i could send a string array, that would be perfect, but i cannot work out how to do that.
please tell me what to do!!!
Send Multiple Strings At Once(winsock)
Like so many others, im making a chat program and i was wondering if it was possible to send several strings in the same little thingy so when someone sends text it send in this format:
Winsock1.SendData (ChatType,Username,Text)
so i can mess with each string separetly when it arrives.
Winsock Multiple Stuff To Send
Hello, I wanted to know if I want to send different stuff to different text box or picture box , do I have to create multiple winsock control ?
Like one 2 for text ( 2 differents infrmations ) +1 for picture ?
If I have to create more than 1 winsock, should I put them in array?
I Need To Send Alot Of Data Through Winsock With Multiple Connections
im doing a testing client/server program which basically for an assignment at my highschool. the servers reads the questions for a test from an ini file and then when the user connects to the server using the client, it sends a request for the first test question ( the test is multiple choice. when the user have answered all 20 questions the test is finished and sends a msg to the server to say the user has finished and the client sends the users answers and the server cuts off that client connection and blocks any reconnection attempt. How can i do this?? has anyone got any ideas??
thanks, dan
Using Winsock For Multiple Connections To Send Lots Of Data
im doing a testing client/server program which basically for an assignment at my highschool. the servers reads the questions for a test from an ini file and then when the user connects to the server using the client, it sends a request for the first test question ( the test is multiple choice. when the user have answered all 20 questions the test is finished and sends a msg to the server to say the user has finished and the client sends the users answers and the server cuts off that client connection and blocks any reconnection attempt. How can i do this?? has anyone got any ideas??
thanks, dan
Winsock, Remotely Send Command, Multiple Paremeters
I have a listener, it listens on port 1016, and a client, the client can send commands to it fine, and I can do like "If TheDaTaThatJustArried = 1 then shell(notepad)" but how would I go about doing a lot of parements.
example, "If theDaTaThatJustArrived = MSGbox then take the title, msg and icon and call a custom msgbox" below is the code I have for the function.
Public Function MsgBoxX(msg As String, title As String, icon As Byte)
Dim MsgBoxIcon As String
If icon = 1 Then MsgBoxIcon = vbCritical
If icon = 2 Then MsgBoxIcon = vbQuestion
If icon = 3 Then MsgBoxIcon = vbExclamation
Call MsgBox(msg, MsgBoxIcon, title)
End Function
this function works fine if I feed it the paremeters directly but how remotely?
How To Make Connection Host-client (client More Than 1) By Using Winsock
Dear all...
i have a problem about my connection....
i use winsock control to receive and transmit message
but it only can work if I only used 1 client (Host can display message
from the 1st client)
for example :
the IP of 1st clent is 107.102.29.11 and
the IP of 2nd Client is 107.102.29.12
and the IP of Host is 107.102.29.10
and the result : host only display message only from 1 client (can be 1st client or can be 2nd client; it depends on which client i start first)
can anyone give me the solution ...?
thanks before...
How Can I Send A Message From One Client To Another Client
I am making a basic messenger program. When a user connects to the server I would like their IP and their Nickname to be sent to the Server. I then add this information to the Userlist. Then, the userlist is updated and sent to each client everytime somebody logs on or off of the messenger.
MY QUESTION IS...
How can I allow one client to click another Clients IP address from the listbox and relay the message from one client to the server and to the chosen client?
I hope I haven't lost any of ya there! ;-) Please help me.
Winsock Query - Server To Client Messages Having Already Received Messages From Client
Hi,
I posted this onto VB Newbies but maybe it's a more intermediate query.
I have set up a client and server app so that many instances of client can connect to the server and send messages at the same time using Index=0 on the Winsock control on the Server.
However,
I want to send messages from server to client also - how can i do this since I get error message "Invalid operation in current state" when I try to connect from server to client - i need to get Winsock(0).State = connected and can't - do i need to name Winsock differently between 2 applications. I looked at www.winsockvb.com but can't find an answer to my problem.
My code on clicking command button on Server app is :
Winsock(0).Close
Winsock(0).RemoteHost = gstrIPAddress
Winsock(0).RemotePort = Val(gstrPort)
Winsock(0).Connect 'Seems like the connect isn't happening here - passes through it...
gstrMessage = "Message to send"
If Winsock(0).State = sckConnected Then
Winsock(0).SendData gstrMessage
DoEvents
End If
Any guidance would be greatly appreciated!! Thanks!
Winsock - Send PictureBox Contents Thrue Winsock?
Hey all, is it possible to send the contents of a PictureBox thrue a Winsock?
I know i can save the contents first to file and then send as file, but wondering this is possible, the purpose is in my chat project i have a webcam capture feature wich works fine, but i can't figure out how i can send this stream, did some searches but not found any results about it.
=============================================
aka Red2048.
Winsock, I Made A Server-Client... Now I'm Trying To Make A Server-Client+++
Trying to get this Winsock Chat thing to support more than 1 person. I don't know at ALL what to do... Could anyone push me in the right direction?
Also, I need help getting screen names to work as well. Thanks.
As you will see, I attempted to add multiple connections myself... I failed. =[
I'm using VB6.
Code:Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_LINESCROLL = &HB6
Dim ClientNum As Integer
Private Sub cmdSend_Click()
Dim strdata As String
strdata = "Server : " & txtmsg.Text
tcpServer(0).SendData strdata
Text1.Text = Text1.Text & strdata & vbCrLf
txtmsg.Text = ""
SendMessage Text1.hwnd, EM_LINESCROLL, 0, 10
End Sub
Private Sub Form_Load()
Dim s As String
s = InputBox("Server Port Number: ")
tcpServer(0).Close
tcpServer(0).LocalPort = s
tcpServer(0).Listen
End Sub
Private Sub Form_Activate()
txtmsg.SetFocus
End Sub
Private Sub tcpServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Not tcpServer(0).State = sckConnected Then
ClientNum = ClientNum + 1
tcpServer(ClientNum).Close
Load tcpServer(ClientNum)
tcpServer(ClientNum).Accept requestID
Text1.Text = "User has entered the server..." & vbCrLf
SendMessage Text1.hwnd, EM_LINESCROLL, 0, 10
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
MsgBox "Wanna-Be AIM"
tcpServer(0).Close
End Sub
Private Sub tcpServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strdata As String
tcpServer(0).GetData strdata
Text1.Text = Text1.Text & strdata & vbCrLf
SendMessage Text1.hwnd, EM_LINESCROLL, 0, 10
End Sub
Send An Image To A Client App?
If I have an image in a picturebox I have captured using BitBlt, can someone show me how to send that to another computer by tcp/ip and display it there? Do I need to save it to file first or is there a way of just grabbing it right from the picturebox and sending it?
Thanks!
How Can I Send An IMAGE With The TCP Client?
I want to use the TCP client to send an image...I can connect and send text and stuff, but I'm having trouble with sending a message...This is what I have so far:
Private Sub cmdSend_Click()
Dim PIC As Variant
PIC = Image1.Picture
'Send the data
tcpClient.SendData PIC
End Sub
And then on the server side I have this:
Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim strData As Variant
tcpserver.GetData strData
Picture1.Picture = strData
End Sub
And it won't work! Someone please help, I'm kinda new to VB...
Thanks..
Send A File To Client PC
I use vb6 to implement a web program. my problem is to send a file to client pc. So how to send a file to client pc when client user access the web page or click a button and the client user don't know about this.
Mail Client- How To Send Images
Hi,
I wrote a little mail client in vb using winsock. It can send mail as html. How would one send images in the body as part of the email not a attachment?
Thank you.
Regards,
Bazza
Send Data To AS400 Client
Hi All,
I am trying to get my VB Program to send some keystrokes to the users Iseries Access client.
I have some articles on using PCOMM, but I can't seem to get this working.
Has anyone done this before?
mot98
"Is it friday yet?"
Send XML Request Using Soap Client 3.0
Hi,
I done with the Soap Client to connect the Web service using WSDL file but i dont know how to send the xml request , to that web service , pls anyone help me
here are code what i have written in my vb
Dim objSOAPClient As New SoapClient
objSOAPClient.mssoapinit ("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl")
Regards
Rakki.M
How To Send Word Document To Client With ASP
I have a mail merge word document that is created on the server which I want to send to a client browser. My original plan was to open the document and save it in a temporary file. Then open the file using the Open statement as a Binary file and send it using Response.WriteBinary but ASP won't let me use the Open statement or the Get statement or any of the file IO functions.
I can use the FileSystemobject to create a File object but the File object only has an OpenAsTextStream method, nothing for binary.
If I send the word doc as text will IE still recognize it as a word doc? Do I have to set the Response.ConentType to a word doc? If so does anybody happen to know the notation for the MIME type of a word file? like "application/doc" or something???? I'd appreciate anybody's suggestions. thanks in advance
Send Emails Without Outlook Client Installed
Hello All,
Is there is any way to send emails through VB6 without Outlook client activated in our system. Please help me out
The requirement is to send automated emails from my program running in a server
Can VB6 Send Verification File From Client's Computer
How can I make my VB6 software which is installed successfully on my client's computer sends verification file (*.txt). The file contains computer and the user names just to make sure that the licensed software will not be traded or misused.
Thanks a lot for any help
Send Request To Another Client And Do The Work After Getting It Approved
Hi............
I'm facing a problem with different clients in VB6. I've a database in my server and many clients are working with that. Those users are actually handling some operations. But no two users can handle the same operation at same time ( this is clients requirement ). I need to update my database as and when another user is handling that operation. So I need to send a request from one user who need to work on that to the user who is already working on that. In order to get all the resources released by that user. So second user should receive acceptance and rejection for his request. This is just like a communication medium between all the users. I don't know how to track all the users and send my request ( Message ) to that particular user.
Plz help me in this..
Manoj
How To Make A Client Send Data To A Specific IRC Channel?
I am not very talented when it comes to VB coding, as I have just started looking at code this past week. I looked at a few tutorials regarding how to send data to an IRC channel, and came across this code. Thing is, it doesn't work. Nothing joins the IRC channel when I test the program. I added a winsock control. I'm just not quite sure what to do, so if anyone could point me in the right direction I would much appreciate it.
edit*
i get this error after running the program "System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146788282
Message="Exception from HRESULT: 0x800A9C46"
Source="Interop.MSWinsockLib"
StackTrace:
at MSWinsockLib.IMSWinsockControl.SendData(Object data)
at AxMSWinsockLib.AxWinsock.SendData(Object data)
at VBNET.HowTo.frmLogin.Winsock1_Connect() in C:Documents and SettingsDavidDesktopBoxfrmLogin.vb:line 169
at VBNET.HowTo.frmLogin.btnOK_Click(Object sender, EventArgs e) in C:Documents and SettingsDavidDesktopBoxfrmLogin.vb:line 109
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms .UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int 32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at VBNET.HowTo.frmLogin.Main() in C:Documents and SettingsDavidDesktopBoxfrmLogin.vb:line 4
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Quote:
Private Sub Form_Load()
With Winsock1
.RemoteHost = "coins.dal.net" ' The IRC server
.RemotePort = 6667 ' Connect on port 6667
.Connect()
End With
End Sub
Private Sub Form_Unload(ByVal Cancel As Integer)
Winsock1.Close()
End Sub
Private Sub Winsock1_Connect()
' Introduce ourselves to the IRC server. Our nickname will be "WVB_Test"
With Winsock1
.SendData("NICK WVB_Test" & vbCrLf)
.SendData("USER WVB_Test " & Winsock1.LocalHostName & " " & UCase(Winsock1.LocalHostName & ":" & Winsock1.LocalPort & "/0") & " :WinsockVB Test Client" & vbCrLf)
.SendData("JOIN #oorgle" & vbCrLf)
End With
End Sub
Send Message To Remote Computer(client/server)
hi;
i have a program.the program is send message to remote computer.send computer is server.server only send message.the remote computer is only client so receive message for read (and print).i have(know) Remote computers ip number.need ip number for communication.I used net send but couldnt.please help me.
Thans...
Send Receive Problem I Have In My Projects ( Server && Client )
Hello all, How are you??
Befoure I'll copy a really big pice of code I was thinkin' your expereience might help me!
I'm developin' few projects in the same time, though i'm developing a Server & Client match software for secure data transffers.
IanB was helped me in a thread I opened about "How to get data from a file into var with limit" ( ex. 1024kb each time )
He gave me the next code:
Code:
Private Const CPY_BUFFER = 1024
Public Function SendFile(ByVal sSource As String) As Boolean
Dim iSNr As Integer
Dim dCount As Double
Dim dRest As Double
Dim sTemp As String
Dim i as Long
SendFile = True
iSNr = FreeFile
Open sSource For Binary As iSNr
dRest = LOF(iSNr)
If dRest < 1 Then
Close iSNr
GoTo ERROR_HANDLER
End If
If dRest > CPY_BUFFER Then
sTemp = Space(CPY_BUFFER)
dCount = Int(dRest CPY_BUFFER)
For I = 1 To dCount
Get iSNr, , sTemp
' Send sTemp Here
dRest = dRest - CPY_BUFFER
Next
sTemp = Space(dRest)
Get iSNr, , sTemp
' 1 final send for any bytes left over (if file is not a multiple of
buffer size)
Else
sTemp = Space(dRest)
Get iSNr, , sTemp
' 1 send here where file < buffer size
End If
Close iSNr
Exit Function
ERROR_HANDLER:
SendFile = False
Close iSNr
End Function
& I edited & update this code to work once on my Server & once on my Client to do the same 2 things.
1 - To Download data & store it in a new file
2 - To Upload data & grab data from a file.
It is working fine! thoughhhh!!
in 1 update i made for this code, was that I added progressbar to the progress of the sends & receive.
In the Server while i'm sendin' a file I'm gettin' it in the same time in the Client side!
BUT!! & here is a big! hugh! B-U-T in here! When the Client sends data it sends it really fast, & the server getting it after some time ( Without stucks or anything ) , the file received succefully but in a late...
Any ideas what can make the diffarents? the Send Receive codes are wrotten the same in the server & in the client with the same Var's!
Any idea of you will might give me a solution, Thanks in advance, & sorry for the use of many many words to describe my problem in this thread :/
Thanks in advance, yours, Yoni D.
WinSock Client
We have applications that may send TCP text data periodically on a LAN. I was asked to provide simple example source code to our international subsidiaries demonstrating how easy it is to receive the data. I tested the following working code and sent it out. Since I've never used WinSock before, I would enjoy any constructive criticism.
Code:
'VB6 Code to receive xmitted data (presumes packets received in xmit order)
'Add a WinSock and TextBox (MultiLine = True) control to a form
Private Sub Form_Load()
Winsock1.Protocol = sckTCPProtocol ' choose the TCP protocol
Winsock1.LocalPort = 9999 ' an example port number
Winsock1.Listen ' tell Winsock to start listening
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
' Close the connection if it is currently open by testing the State property.
If Winsock1.State <> sckClosed Then Winsock1.Close
' Pass the value of the requestID parameter to the Accept method.
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String ' Create a buffer
Winsock1.GetData strData, vbString ' Store received data in buffer
Text1.Text = Text1.Text & strData ' Show on screen
End Sub
Private Sub Winsock1_Close()
If Winsock1.State <> sckClosed Then Winsock1.Close ' Close this end
Winsock1.Listen ' Listen some more
End Sub
IRC Client - Winsock -
hey,
I am working on an IRC Client
1) When u change your nick to a regestered nick, NickServ will tell u to put the password, or change the nick
it sends them so fast, winsock is only working on the first data
how to make winsock faster or do somthing, so it will do all the datas?
I made a very simple Code
Code:
Private Sub sckIRC_DataArrival(ByVal bytesTotal As Long)
Dim sRecv As String, TrueMessage As String
Dim x As Long, LeftLen As Long
sckIRC.GetData sRecv
If InStr(3, sRecv, ":") > 0 Then
x = InStr(3, sRecv, ":")
LeftLen = Len(sRecv) - x
TrueMessage = Mid$(sRecv, x, LeftLen)
Exit Sub
End Sub
pure message
Code:
:NickServ!services@wikkedwire.com PRIVMSG WhatEver :This nickname is registered and protected. If it is your
:NickServ!services@wikkedwire.com PRIVMSG WhatEver :nick, type /msg NickServ IDENTIFY password. Otherwise,
:NickServ!services@wikkedwire.com PRIVMSG WhatEver :please choose a different nick.
Result
Code:
This nickname is registered and protected. If it is your
:NickServ!services@wikkedwire.com PRIVMSG WhatEver :nick, type /msg NickServ IDENTIFY password. Otherwise,
:NickServ!services@wikkedwire.com PRIVMSG WhatEver :please choose a different nick.
how to solve this?
2)
I was able to do everything untill now, except listing the channels, I have no idea how to do it... can anyone help
I know it is like
Code:
sckIRC.SendData "LIST" & vbcrlf
but this will list what channels? or what server?
help please
Winsock Client
I am writing an application that will be a winsock client to a industrial controller with an ethernet interface. The application has several methods that will call the winsock control to retrieve information from the controller.
Here's my question: SendData is a method of the winsock control, but you don't know data is received until the DataReceived event is triggered - then you can GetData. How can I tell which method asked for the data that is being returned?
Get Client's IP Using Winsock
Hi, i got question abt the VB winsock.
I develop one server program to get the data from clients using winsock.
In my server program, how can the server know which data is from which client?
I used the Winsock1.RemoteHostIP to get the client's IP. But there is nothing return.
Thank you!
Multiple Client Connections
I've seen programs like Trillian and GAIM that allow you to sign on to MSN, Yahoo, AIM, and ICQ with multiple accounts. I don't know how many programs like these are written in Visual Basic, or even if this is possible in Visual Basic, but how is this done? I figured that there'd be an array of Winsock controls, each connecting to the servers and thus giving you multiple accounts. But to contradict, I've read that you can't do this using an array of Winsock controls - you'd have to literally put a control for each account. Who's right and who's wrong? Do you need one Winsock for each client connection, or can you use one Winsock for all of the connections using an array? Thanks in advance.
Multiple Client Application
I'm creating a multiple client program where the clients are allowed
read-write access to the server. I have no problems running the program
with only one client accessing the server. But Im afraid I might run
into problems once I have more than one client reading-writing to the
server. I heard that errors may come out if one client tries to update
a database in the server, at the same time that another client is in the
process of updating the database. A data error or access error might
come out in my program.
How do I make sure that if clientB for example sees that clientA is
updating the database, clientB will wait until clientA has finished his
update before updating the database himself? What error trapping code
do I use to create this functionality?
I am presently using a Visual FoxPro database accessed by my VB project
through ODBC. When I create recordsets, their locking properties are
set to adLockOptimistic.
Thanks for any help you can give me.
Regards,
Jem Idea
Chating With Multiple Client
Hi
Sample code for chating with multiple clients simulataneously in the LAN.....
Kindly help me by giving your ideas ...............
[WinSock] FTP Client Problem
Hello everyone,
Yesterday I started creating an FTP client using WinSock.
I can connect to my IIS. Please note the "connect", because I only can connect, but not log on or get files.
A little time ago I started working on a web Browser, you had to send this header like:
---
HTTP/1.0 Get /index.htm
User-Agent: Mozilla 4.0
Host: (computername)
---
Does anyone know how FTP connects?
Here's what I tried:
1. Connect to localhost, port 21. Works.
2. Sent "USER IUSR_CODECASTER". Message was sent, crap was returned: ?????4?????????? or so
3. Sent "PASS test". Message was also sent, crap was returned again: ?????%??????^??? or so
I tried searching Google and this forum but found nothing. Can anyone help?
Winsock UDP Dummy Client
I have developed a small UDP broadcasting program and want to be able to create multiple dummy clients instead of physically testing it.
The problem is when I created a dummy client it states "address in use". Can anyone explain to me why this is the case and if there are any other possible ways to create dummy clients?? I Appreciate any response.
My source code is attached below:
Private Const port As Integer = 1001
Dim lngCounter As Long
Private Sub cmdBroadcast_Click()
'Broadcast the data in txtData
udp.RemoteHost = "255.255.255.255"
On Error GoTo ErrorHandler
udp.SendData txtData.text
Exit Sub
ErrorHandler:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, Err.Number
End If
Resume Next
End Sub
Private Sub cmdClear_Click()
txtReceived.text = ""
End Sub
Private Sub cmdCreateClient_Click()
'Dummy clients - by creating newServer objects.
'Explicitly create newServer objects based on Form frmServer.
Dim newClient As Form
Set newClient = New frmServer
'Use lngCounter form-level variable to display the Form
'based on connection order.
lngCounter = lngCounter + 1
newClient.Caption = "Client " & Str(lngCounter)
'Load the newClient object and display it.
Load newClient
newClient.Show
End Sub
Private Sub cmdUnicast_Click()
If txtIP.text = "" Then
MsgBox "Please enter the IP address of the reciever. Please try again."
If txtData.text = "" Then
MsgBox "Please type in a message to send. Please try again."
txtIP.SetFocus
Else
udp.RemoteHost = txtIP.text
'Change the remote host from everyone to the specified IP address
'Unicast the data in txtData to specified IP address
On Error GoTo ErrorHandler
udp.SendData txtData.text
MsgBox "Message has been sent to IP address: " + txtIP.text + "."
Exit Sub
End If
End If
On Error GoTo ErrorHandler
ErrorHandler:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, Err.Number
Resume Next
End If
End Sub
Private Sub Form_Load()
'Set up the Winsock control
With udp
.Protocol = sckUDPProtocol
.LocalPort = port
.RemotePort = port
.RemoteHost = "255.255.255.255" ' This is the broadcast IP
End With
lblLocalPort.Caption = port
lblRemotePort.Caption = port
lngCounter = 0
End Sub
Private Sub udp_DataArrival(ByVal bytesTotal As Long)
Dim IncomingData As String
'Data has arrived so display it
udp.GetData IncomingData
addText IncomingData, txtReceived
'txtReceived.text = IncomingData
End Sub
Private Sub udp_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
'An error has occurred so display a description
MsgBox Err.Description, vbCritical, Err.Source
End Sub
Private Sub addText(ByVal text As String, ByRef Box As TextBox)
Box.text = Box.text & text & vbCrLf
Box.SelStart = Len(Box.text)
End Sub
Winsock Client Disconnect
Hi all,
I've created a Server Application using Winsock Controls. My problem is when I have 2 clients connected to the server, then client1 disconnects intentionally. I cannot seem to reconnect client1 to the server after disconnecting. I am sure it has something to do with the .state property. But I am unable to get it right. Could anyone help?
P.S. I have 3 apps running as follows:
Client 1
Client 2
Server
Vb Winsock , Client Server Help
I have a client server app that i made and it is working fine, the users can chat and send privatemessages but i have a problem with the user list, When a user connects it adds their username to a list box on the server. The server then loops through the connections and loops through all the index's on the listbox and sends all the data to the clients. It works if there is 1 or two people connected when the third person connects it does this:
user,1
user,2
user,20
Now this is the way that i am sending data from the server to the client:
ElseIf splt(0) = 0 Then
List1.AddItem splt(1)
List2.AddItem splt(1) & "," & connect_num
For i = 1 To connect_num
For listn = 0 To List2.ListCount - 1
Winsock1(i).SendData "0," & List2.List(listn)
DoEvents
Next listn
Next i
Exit Sub
Note that the "0," is the way that i parse data, so that when the clent recieves that it knows that it is adding splt(1) to the listbox.
This is the way that the clent recieves the data:
ElseIf splt(0) = 0 Then
List1.AddItem splt(1) & "," & splt(2)
DoEvents
Exit Sub
Please any help would be awesome!
Winsock Server/client In One?
Hi,
I got a winsock that connects to a remoteip + port, and my problem is when the reply is comming back since the server is sending the reply back to the same port that it got the data from.
eg.
1. Winsock1 sends the data "hello" to SERVER
2. SERVER sends the reply back to the port that winsock1 is using.
How can i capture the reply? Can one winsock act as both client and server at the same time?
thanks,
naitsabes
Winsock Server Client
I want to do a program that people can use to chat. I want to send them the client and i will have the server. I want to use winsock to do this... can anyone help?
[Winsock] Getting Client IP Address
I'm writing a Telnet Server in Visual Basic.
I'm using winsock for practically all taks.
Everything works nice and smooth but I'd like to display the client's ip address on the server.
Is there a way to enquire that information on the server side?
Winsock And Client Server.
in a client-server situation using winsock, is there a simple way of clients serching a range of IP's to check if a port is open (running the server) if so, add it to a list ..
for eg. a game uses port 10 to send small packets to client, so the client must search a range of IPs with port 10 open, to get a list of IP's within the range that has the game loaded.
Winsock Client Closure
Hey all you winsock fans! (my cherry post!)
Ive been working on a chat server/client and am having
a problem with remote termination of a client crashing the server
Everything works fine if the remote user uses the designed
means by which to exit the prog. but if their ISP kicks it then
it crashes my server. As the winsock control for the the terminated
client is still active on the server,the server will
still try to echo back to the disconnected client. I would like to
know the most efficient way to verify connectivity and/or take
the appropriate action when it ceases.
ie. Will the 'if winsock=sckclosed' actually determine if a sudden
remote termination has taken place, like an remote system crash?
or should i 'ping' the client with a packet of data bound to a timer,
wait for a nonresponse and take the appropriate client closure
action during the error event?
im looking for the most comprehensive and most efficient answer
involving the least amount network congestion that will
allow for the continuous, fluid function of the server/host.
Winsock, Chat Client!?
hi yall, how do i start to make a p2p chat client with file transfer? do i need a server, or can this be done without one? and also i know the winsock component needs to be used, but how do i get it to connect, i mean do i have to make the program get both of thier IP's and connect?
|