Record Locking In Multiple Clients Application
Hello Everybody!!
I am currently developing application which is desktop application for around 100 users.
Out of hundred may be 20 to 25 will be logged in at the same time.
I would like to know any solution to keep track of record edition.
If one of the user is editing any record, other should not be able to do edit at the same time.
Is there any soln?
Please advise.
Thanks and Regards,
Pankaj
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Access And Record Locking
I have two programs(prog1 and prog2) in VB that accesses the same table(table1) in SQL Server 7.0. prog1 loads data from AS400 to table1 every morning. At the same time prog2 accesses table1 and changes the data. prog2 has multiple users. Can prog2 users update and make changes to table1 while prog1 is loading data to table1. None of the users access the same record. But different records in the same table.
We don't have a DBA and what are the possibilities of blowing up SQL Server? What are the posiblities of blowing the programs.
This is the locking method I have used.
rsPick.Open SQL, conVB_SDS, adOpenDynamic, adLockOptimistic
What other options do I have.
Than You, any help would be appreciated.
Multiple Clients
How do I produce a server that handles multiple connections on an IP address?
I have an information server, that currently listens for connections on port 23. How do I allow it to listen for more than one?
I'm assuming it is a control array, but could't get it working with winsock control.
What is the limit for creating control arrays?
Cheers for any help
Craig.
Multiple Clients Winsock
Hi guys..
I have a kind of a server - client App.. the servers, excepts data, and executes commands depending on the data recived. the problem is there are multiple clients, when these multiple clients tries to acess the server there is an error. how do i hjandle multiple clients with winsock in the server?
p.s - the clients do not really stay conencted for a long time,its not necessary to keep the connection for a long period of time
thanks
Relaying Data To Multiple Clients
ok, i don't know why this isn't working, it seems like it should. some info you should know: wskConn(0) is the one that listens. blnArray() is a parallel to wskConn() (so like blnArray(1) = wskConn(1) ). its true if the matching wskConn is connected to a client and false if its not. if you need more of my code so you know whats going on just say so.
Code:
Private Sub wskConn_DataArrival(Index As Integer, ByVal bytesTotal As Long)
On Error Resume Next
Dim I As Integer
Dim Incoming As String
For I = 1 To wskConn.UBound
If blnArray(I) = True Then
wskConn(I).GetData Incoming
If Incoming = "idle" Then
wskConn(I).SendData "ok_close"
wskConn(I).Close
blnArray(I) = False
UserCount = UserCount - 1
lblCount.Caption = UserCount
End If
End If
Next I
End Sub
Winsock Error Multiple Clients
i have a central call tracking app, monitoring calls between users in the company.i need to send the call date associated with the call to the respective users . for this purpose i have a database of Ipaddresses asscoiated with the users , which is automatically refeshed.
ther are abt 80 client machines,and the code in the server side looks like this;
If IPAddress <> "" Then
Winsock1.RemoteHost = Trim(IPAddress)
Winsock1.RemotePort = 1007
Winsock1.Connect
DoEvents
If Winsock1.State = 7 Then
Winsock1.SendData "Internal" & ";" & DestNumber & ";" & StartDateTime & ";" & ChDur & ";" & Trim(DialledPerson) & ";"
DoEvents
End If
Winsock1.Close
End If
If CType = "I" And DialledIP <> "" Then
Winsock1.RemoteHost = Trim(DialledIP)
Winsock1.RemotePort = 1007
Winsock1.Connect
DoEvents
If Winsock1.State = 7 Then
Winsock1.SendData "Incoming" & ";" & AuthCode & ";" & StartDateTime & ";" & ChDur & ";" & Trim(UserName) & ";"
DoEvents
End If
Winsock1.Close
End If
in the client side i have;
Private Sub socket_Close(Index As Integer)
Socket(Index).Close
Unload Socket(Index)
iSockets = iSockets - 1
End Sub
Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
sRequestID = requestID
iSockets = iSockets + 1
Load Socket(iSockets)
Socket(iSockets).LocalPort = 1007
Socket(iSockets).Accept requestID
End If
End Sub
Private Sub form_Load()
Socket(0).LocalPort = 1007
Socket(0).Listen
End Sub
Private Sub Socket_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Socket(Index).GetData sItemData, vbString
'' Process here
End Sub
as you can see i am sending data to 2 client machines per call, but somehow only one of the machines seem to be receiving the data.
on further inspection , i found out that this is because of a socket error
ie...winsock1.state=6 '' SckError
so..the data is never sent.
however the same client seem to be receiving some of the data.
why is this so?
Multiple Clients && Server Model
Ok - I've seen plenty of projects/tutorials on getting a single client to connect to a server, and send strings to the server using Winsock.
That's cool.
What I need to do is the following.
Have multiple clients (with individual lan IP addresses) connect to a central LAN server program to communicate with each other.
A few questions I have, firstly how is this done?
Does each client need the same remote port (the local port of the server) and its own unique port for information coming back from the server?
How do I get only specific strings to specific clients via the server? Using SendData and GetData, how can i distinguish which client is sending the data and which should be receiving it?
How do I work the .open .close and .listen states for the winsock control on the server and client so that there is always the ability to send and receive data?
I want to set up a basic chat that all people can talk in, but 2 people can initiate a 'battle' where they fight each other by pressing buttons to cast spells etc. This information is sent back and forth to the two clients via the server.
Any ideas, code people?
Thanks in advance.
Winsock Can Handle Multiple Clients
Dear Folks,
i have another problem.. i have a project which is handling the requests of clients... Actually we give a software to our clients when our clients open our software first time on his system then a request is generated and it arrives on our synchronization software... it will make a file of all data of our client and send to it... it is working fine for one client request at a time... but if a user send his request after some time another user send his request then the winsock goes for the second request before sending the file to first user... i know vb can't handle multi threading. what can i do in when multiple clients sent there requests...
Connecting Multiple Clients To Server
i m making a client server application where server contains an array of sockets and are listening at different ports. when client connects to the server, it tries to connect at different ports (those defined in server side) till it gets connected. but only one client gets connected, other fail to get connected. here is code :
--server--
p = 500
for i = 1 to 10
load(tcpserver(i)
tcpserver(i).localport = p
tcpserver(i).listen
p = p+1
next
---------
-- client --
sub connectToServer()
c = 0
tcpclient.remotehost = serverIp ' whatever the ip is
For p = 500 To 510
reconnect:
tcpClient.Close
tcpClient.RemotePort = p
tcpClient.Connect
p = p + 1
While tcpClient.State <> sckConnected
DoEvents
c = c + 1
If c = 10 Then
c =0
GoTo reconnect
end if
Wend
If connectedToFileServer then
Exit For
End If
Next
end sub
---------------
Private Sub tcpClient_Connect()
connectedToFileServer = True
End Sub
Relaying Data To Multiple Clients
ok, i don't know why this isn't working, it seems like it should. some info you should know: wskConn(0) is the one that listens. blnArray() is a parallel to wskConn() (so like blnArray(1) = wskConn(1) ). its true if the matching wskConn is connected to a client and false if its not. if you need more of my code so you know whats going on just say so.
Code:
Private Sub wskConn_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim I As Integer
Dim Incoming As String
For I = 1 To wskConn.UBound
If blnArray(I) = True Then
wskConn(I).GetData Incoming
If Not Incoming = "idle" Then
wskConn(I).SendData Incoming
Else
wskConn(I).SendData "ok_close"
blnArray(I) = False
wskConn(I).Close
UserCount = UserCount - 1
lblCount.Caption = UserCount
End If
End If
Next I
End Sub
No Of Clients In C-S Application...
Hello Experts,
In a client server application developed in VB.Net, I need to connect at least 25 clients. But when the number exceeds 10 clients, it doesn't allow any more client to be connected. I have tested it in both Windows 2000 server and XP as operating system in the server and the result is same. Is there any such restriction in either of these OSs...?
Any solutions...?
Thanks in advance.
Regards, Manabesh Discover. Explore. Connect-Windows Live Spaces. Check out!
Help: Using ActiveX EXE To Share Data Among Multiple VB6 Clients
VB6 question. I am totally frustrated in trying to use an ActiveX EXE COM object to share data among several independent processes. In the final product, I want to have several large arrays which can be updated by two independent EXE processes, and read by two others.
I cannot get the array to be shared. HELP!!!
For testing, I have created a simple COM class with one simple 5-element array and a a simple VB6 EXE client to exercise the ActiveX thing. I want to be able to start several of the clients and have all of them see one and only one 5-element array. I.e., if I push the value "5" into the ActiveX's array from one of the clients, then ALL the clients should be able to see that 5.
The complete VB client form and class files can be found below.
/////// the ActiveX COM: clsCOMshare.cls ///////
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsCOMshare"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'======================== ActiveX
' Project: COMshareMem
' Class: clsCOMshare
'========================
Option Explicit
Dim arr(4) As Integer ' this SHOULD BE shared, but alas, is not.
Public Event OnReturn()
Public Function AcknowledgeSelf() As String
AcknowledgeSelf = "clsCOMshare is alive"
RaiseEvent OnReturn
End Function
Public Property Get TopVal() As Integer ' return arr(0)
TopVal = arr(0)
End Property
Public Sub PushTopVal(intVal As Integer)
Dim i As Integer
For i = 4 To 1 Step -1
arr(i) = arr(i - 1)
Next i
arr(0) = intVal
End Sub
' return the integer value in the array at index theSlot
Public Property Get SlotVal(theSlot As Integer) As Integer
SlotVal = arr(theSlot)
End Property
////// The Client App frmCOMshareClient.frm ///////
VERSION 5.00
Begin VB.Form frmCOMshareClient
BorderStyle = 3 'Fixed Dialog
Caption = "COMShareClient"
ClientHeight = 3315
ClientLeft = 45
ClientTop = 435
ClientWidth = 2850
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3315
ScaleWidth = 2850
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton btnShowArr
Caption = "Show arr"
Height = 255
Left = 1410
TabIndex = 10
Top = 75
Width = 1080
End
Begin VB.TextBox tbPushVal
Height = 330
Left = 105
TabIndex = 4
Text = "-17"
Top = 390
Width = 945
End
Begin VB.CommandButton btnPopVal
Caption = "Get Top Val"
Height = 315
Left = 1440
TabIndex = 2
Top = 2235
Width = 1005
End
Begin VB.CommandButton btnPushAVal
Caption = "Push a Val"
Height = 315
Left = 90
TabIndex = 1
Top = 75
Width = 945
End
Begin VB.CommandButton btnGetAck
Caption = "Get Ack"
Height = 345
Left = 60
TabIndex = 0
Top = 2925
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00C0FFFF&
Caption = "In real life, an async TCP event in an independent EXE will present and push values."
Height = 1485
Left = 45
TabIndex = 11
Top = 735
Width = 1110
WordWrap = -1 'True
End
Begin VB.Label arr
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Height = 240
Index = 4
Left = 1440
TabIndex = 9
Top = 1440
Width = 1005
End
Begin VB.Label arr
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Height = 240
Index = 3
Left = 1440
TabIndex = 8
Top = 1170
Width = 1005
End
Begin VB.Label arr
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Height = 240
Index = 2
Left = 1440
TabIndex = 7
Top = 900
Width = 1005
End
Begin VB.Label arr
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Height = 240
Index = 1
Left = 1440
TabIndex = 6
Top = 645
Width = 1005
End
Begin VB.Label arr
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Height = 240
Index = 0
Left = 1440
TabIndex = 5
Top = 375
Width = 1005
End
Begin VB.Label lblPoppedVal
Alignment = 2 'Center
BackColor = &H00C0E0FF&
Caption = "lblPopppedVal"
Height = 300
Left = 1440
TabIndex = 3
Top = 2565
Width = 1005
End
End
Attribute VB_Name = "frmCOMshareClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'================================================
' frmCOMshareClient
' Client for the clsCOMshare ActiveX COM object
'================================================
Option Explicit
' This needs to allow access to a SHARED,
' COMMON array maintained by the ACTIVEX/COM array
Dim Stack As clsCOMshare
' PROBLEM: if two instances of this form are started (via compiled EXEs),
' each instance creates an independent (non-shared) arr variable instead
' creating ONE arr variable which the two instances push and pop integers
' in a 5-cell array. In real life, the array will be 5,000 cells.
'
' DESIRED: if two instances of this form are started,
' integer values should be able to be "Pushed" from either instance
' and then clicking on the "Show arr" button in the OTHER instance
' should show the arr values Pushed in the other instance.
'
' EXAMPLE:
' Start instance-1, start instance-2
' In instance=1,
' Enter "12" in the white text box,
' Press the "Push a Val" button
' 12 appears at the top of the array of green labels
' In instance-2,
' Press the "Show arr" button
' 12 SHOULD appear in the green labels on instance-2
Private Sub btnGetAck_Click() ' retrive string from ActiveX
Dim sReturn As String
sReturn = Stack.AcknowledgeSelf
MsgBox "COMShareTest ACK returned: " & sReturn
End Sub
Private Sub btnPopVal_Click() ' get topmost value of arr in ActiveX
lblPoppedVal = CStr(Stack.TopVal)
End Sub
Private Sub btnPushAVal_Click() ' push down arr values and insert this one
Stack.PushTopVal CInt(tbPushVal.Text)
ShowArr
End Sub
Private Sub btnShowArr_Click() ' retrieve and display all values in arr in ActiveX
ShowArr
End Sub
Private Sub ShowArr() ' retrieve and display all values in arr in ActiveX
Dim i As Integer
For i = 0 To 4
arr(i) = Stack.SlotVal(i)
Next i
End Sub
Private Sub Form_Load()
Set Stack = New clsCOMshare ' instantiate an ActiveX object
'Stack.AcknowledgeSelf ' during debug only
ShowArr ' display all values in arr
End Sub
Private Sub Form_Unload(Cancel As Integer) ' vanish the object
Set Stack = Nothing
End Sub
Need Help Connecting Multiple Clients In Chat Program
I'm rather new to net coding in VB6 and I have a problem. I read the tutorial on the now-dead winsockvb.com awhile ago, and I have just made a few changes to it myself. I was trying to make it so that multiple clients could connect to one server, and it would act sort of like IRC. But, I'm having an odd problem. I made it so that whenever a client sends some text, instead of sending it out and assuming it got to the server and adding it to the "sent text" box itself, it would just send it to the server, and then the server would send it back to ALL clients, including the one that sent it. This solved two problems, 1) making the sender sure that his message hit the server and 2) removing the specific client from the loop to send his message to other clients. My problem then is, that for some reason the server only communicates with the most recent client connected unless forced otherwise. An example of this can be seen here:
Code:
Private Sub Winsock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim strData As String
Dim i As Integer
Winsock(Index).GetData strData
strData = strData & vbCrLf
txtSaid.Text = txtSaid.Text & strData
For i = Winsock.LBound + 1 To Winsock.UBound
'There is an array of winsocks, winsock(0) is always to remain open to recieve
'incoming connections, if it is accepted, then a new winsock is loaded
Winsock(i).SendData strData
Next i
End Sub
Let's say 2 clients were connected to the server. If I were to send a message from any client, the server would get it, but would only send the recieved messages to the most recent client to connect. I've shown this with a screenshot:
http://tinyurl.com/goa7m
Here is the code I have from winsockvb.com showing how to load more winsock controls if more clients connect:
Code:
Private Sub winsock_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
Dim i As Integer
Dim j As Boolean
j = True
For i = Winsock.LBound + 1 To Winsock.UBound
If Winsock(i).State <> sckConnected Then
Winsock(i).Accept RequestID
j = False
Exit For
End If
Next i
If j = True Then
Load Winsock(Winsock.UBound + 1)
Winsock(Winsock.UBound).Accept RequestID
End If
End Sub
I though that it might be disconnecting the clients for some reason, and as you can see in the screenshot I made those 6 command buttons that are coded like this:
Code:
Private Sub ws1_Click()
Winsock(1).SendData "Test WS1"
End Sub
Private Sub ws2_Click()
Winsock(2).SendData "Test WS2"
End Sub
Private Sub ws3_Click()
Winsock(3).SendData "Test WS3"
End Sub
Say clients 1 and 2 were connected, and only client 2 was getting all the data the server was supposed to be sending all clients. As soon as I hit the client 1 button to test if it's still connected, all the data that was supposed to be sent earlier gets sent (or recieved) when I hit the test button. I've gone over my code several times, and I've searched multiple forums and eangines, only to learn that searching for specific problems is pretty useless.
I think I have shown everything that one would need to know what is going on and possibly know a fix. (If not please tell me what needs to be added) Any help is greatly appreciated!
Programming A LAN RPG Using Multiple Clients --> Single Server.
Hi guys.
Just wanted to query something here. Does anyone have any exampels, psuedo code or tutorials that will help me with my aim of creating a small text & button based RPG over our work LAN?
I basically want a model where I run a small app which is the server, and everyone else runs clients which connect to - and communicate through - the server program (hopefully using Winsock control).
People would 'fight' each other from their clients, clicking on and casting spells etc, with only 2 clients able to be engaged in combat at a time. To determine what types of things are being sent between the clients, i'd use strings of data, with header characters, like HT10 (the 'HT' which would indicate a hit to the other clients charcter, of 10 health) then split the string up to get the HT and the 10 and use them accordingly.
I want all clients to be able to receive messages about each round of the fight (spectating) but only 2 clients actually fighting.
So far all I can make is a client which can send a string to another client. If i try and make two programs, both of which act as a server AND a client, only client A can connect to client B and send strings, if (while that connection exists) i try and connect Client B back to Client A, it fails with an error about not being in the correct 'state' etc.
Sorry for the long post!
EXPERTS ONLY ! Voice Chat With Multiple Clients
Honestly, I don't expect anyone would be able to solve my problem (because of it's difficulty), but I'm gonna try anyways...
I made a voice chat program that works well. It's using ACM to encode to MP3, and the reverse on receiving side. So server and client encodes and decodes simultaniously since sound has to go both ways.
The program is using TCP for general messages, and UDP for sound transfer.
The program sends sound data only when the sound goes over a threshold of 5%, so in other words, the program does not send anything until you make a noise (you talk).
This works fine for a 1 to 1 connection.
What I want is to make the voice chat program connect directly to each client, so for example if there are 3 people talking to each other, I want each one to be connected to the other 2, and so on for more clients.
The problem is handling the sound for multiple users.
Decoding the individual sounds from diferent clients is no problem, the problem is once it becomes wave data, I don't know how to mix the sounds.
I know this sounds ironic since I made a sound tutorial, but this is different, the sound is a stream, and is not always there....
What I mean is, sometimes you have one client talking sometimes to have 2 at the same time (or more), where the sound might or might not overlap at diferent point in time.
I don't know how to keep track of buffer positions, and also how to do the mixing of the sounds.
From what I know the formula for mixing sounds is:
mixed_sound = (sound_1 + sound_2) / 2
in other words, making a average of the 2 sounds, and if there are 3 sounds, then an average of the 3, and so on...
Lets say client A starts talking and he talks to 10 seconds, client B starts 3 seconds after client A started and he talks for 2 seconds.
This means that from secod 3 to 5, it will have to mix the sounds A and B, this also means that client A will sound at lower volume while B is talking (the rule of mixing)
I was thinking not to divide the sounds by number of sounds, just add them together, ie. mixed_sound = sound_1 + sound_2 + .... etc
I know that regular chat programs don't allow you to talk at all when one person is talking, so only one person can voice chat at one point in time, but I want to break that barrier.
Anyways, this is becomming a long post, what do you guys think so far ?
Multiple Clients Connecting To Winsock Server?
Is it possible to have multiple clients connecting to the same winsock server?
Maybe I should explain my situation in order for you to fully understand my question...
There are at least 3 computers. One will act as a "server" that will need to communicate with the other computers (I'll call them "clients").
The server will send messages to the "clients" so that they can perform general commands (determine if the hardware connected to that client is ready, determine if the hardware is in the load position, etc, etc). It then needs to relay this information back to the "server" so that the server can tell the "client" what it needs to do next.
The problem I'm running into is that the Winsock control only seems to allow one "client" to connect to the "server" at a certain time. Does this mean that I will need a seperate "server" instance for each "client"? Am I missing something here?
Is there a better way to do all this?
Thanks in advance!
Sending Text / Data To Multiple Clients ...
Hi,
I am using the Winsock Control with my CLIENT and SERVER programs.
I am having trouble to get data from: CLIENT1 -> SERVER -> CLIENT2, CLIENT3,etc
I use the For loop, but it seems to skip a few clients:
for intloopindex2 = 1 to frmServer.List1.ListCount - 1
next intloopindex2
' MsgBox (intloopindex2)
frmServer.Label1.Caption = intloopindex2
If intloopindex2 = 1 then
Server(intloopindex2).SendData a(Index)
ElseIf intloopindex2 = 2 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
ElseIf intloopindex2 = 3 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
ElseIf intloopindex2 = 4 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
ElseIf intloopindex2 = 5 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
Server(intloopindex2 + 4).SendData a(Index)
ElseIf intloopindex2 = 6 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
Server(intloopindex2 + 4).SendData a(Index)
Server(intloopindex2 + 5).SendData a(Index)
ElseIf intloopindex2 = 7 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
Server(intloopindex2 + 4).SendData a(Index)
Server(intloopindex2 + 5).SendData a(Index)
Server(intloopindex2 + 6).SendData a(Index)
ElseIf intloopindex2 = 8 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
Server(intloopindex2 + 4).SendData a(Index)
Server(intloopindex2 + 5).SendData a(Index)
Server(intloopindex2 + 6).SendData a(Index)
Server(intloopindex2 + 7).SendData a(Index)
ElseIf intloopindex2 = 9 then
intloopindex2 = 1
Server(intloopindex2).SendData a(Index)
Server(intloopindex2 + 1).SendData a(Index)
Server(intloopindex2 + 2).SendData a(Index)
Server(intloopindex2 + 3).SendData a(Index)
Server(intloopindex2 + 4).SendData a(Index)
Server(intloopindex2 + 5).SendData a(Index)
Server(intloopindex2 + 6).SendData a(Index)
Server(intloopindex2 + 7).SendData a(Index)
Server(intloopindex2 + 8).SendData a(Index)
End If
Only when I use a msgbox to display the for loop variable, the CLIENT sending works. Any help will be great!
Thanx
Multiple Clients Accessing A Single Server
hi,,,
can some body please tell me how can i make a server using winsock which can listen to multiple clients?
i have tried the control array for winsock control but since i am not able to anticipate which connected client will exit it is not possible for me to release that particular instance of the control...
the application i am developing is simple multiple clients connected to a server and a access database and as soon as one client enters data it is reflected to other clients immediately...
thanks in advance
Sending SMS To Clients Via VB6 Application
I have developed inventory system for my client who have business of readymade garments now they want that whenever new collection will come .the Application can send sms to their clients whose mobile numbers are in the database . So I have developed system in VB6 so please guide me different techniques of sending SMS through vb6
Multiple Clients, Primary Field Violation When Writing
I have a table in access database that has a primary key which is not an auto number.
Clients read the MAX of this primary Key, increment it by 1, and write to the table.
When multiple clients try to write at the same time, they read the same MAX value and so try to write different records with the same Primary Key value which results in primary key violation.
For now, I am trapping primary key violation and overcoming the situation by making the write sub a recursive one.
Is there a way other than trapping primary key violations to post data from different clients at the very same time?
I mean a sql technique that can always give the correct value for the primary key before writing.
Thanks all.
How Can You Have A Winsock Server And Work With Multiple Clients That Connect ?
Anyone have a sample application or code that shows how to have a winsock server on a specific port, and be able to accept multiple clients to that port and be able to distinguish between the connections?
Basically I want to make a very simple application where 15 computers connect to my winsock server, and the server deals commands to these 15 computers and receives input from them.
Winsock - Sending Messages From Server To Multiple Clients.
HI,
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.
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.
Any guidance would be greatly appreciated!! Thanks!
Record Locking At Record Level
I can't seem to write a demo program that show recordset locking at the record level before it's been editied.
I have set the parameter
Connection IsolationLevel=adXactReadCommitted
ServerSide Cursors
Pessemistic Locks.
I have 2 recordset variables. Both Accessing the same record. I would
have thought that once 1 RS is opened the other would not be allowed to
open it until it has been released, but this doesn't seem to be the case.
Can anybody point me in the right direction or some sample code.
Thanx in advance.
Running VB Application On Clients Machines
my VB application doesn't work on the clients machines which did not install the VB 6 do i have to install something special to the computers?? .dll mabye???
i remember one site was offering such a thing but i don't really now the exact address or the site name
HELP ME as soon as possibol
How To Distribute ASP Web Application To The Clients"
Hi,
I would like to know how to distribute ASP web application to the clients. The ASP source code should not be given to the client side installation.
Is there any way like we can put all the files in an ActiveX dll so nobody can see the source code, Use ActiveX dll to access all the ASP files.
Please provide me all the nformation thats related to this.
Thanks in advance
Sure
- Sending Data To Multiple Clients Via Winsock- Same 40006 Error.
trying to send data to multiple clients, but keep getting same error - 40006: Wrong protocol or connection state for the requested transaction or request.
The first send works fine- always throws error on 2nd recipient. Nothing wrong in sending just one request to that client.
2 Winsocks, not indexed - vb6
Code:
Code:
'SEND TO FIRST
With frmWinsocks.Winsock5
.Connect 192.1.1.111, 1007
.SendData "data"
DoEvents
Call frmWinsocks.SafeCloseAfter 'CLOSES CONNECTION
DoEvents
End With
'SEND TO 2ND
With frmWinsocks.Winsock6
.Connect 192.2.2.222, 1008
DoEvents
.SendData "data 2" '<-ERROR HERE - error #40006 - the state is 6 (connecting), but shouldn't be
DoEvents
Call frmWinsocks.SafeCloseAfter6 CLOSES CONNECTION
DoEvents
End With
ARE THERE ANY ADVANCED WINSOCK CONTROLS OUT THERE? SOMETHING WITH ERROR CHECKING AND MULTIUSER SERVER/CLIENTS?
Edited by - pbeast on 2/3/2007 2:58:25 AM
How Can I Restrict My Clients To SETUP My Application Only One Time?
I created my application's SETUP and i had given it to my clients. But i want my clients can use the setup for only one time. ie, they can able to install my application in only one system. There after if they want to install it would not allow them. What i have to do for this?
Compile Vb6 Application In Xp Kernel Error In W98 Clients
Hi Everybody,
I developed an application Visual Basic 6.0 and compile it in a XP machine, when this aplication runs in a clients windows 98 SE produces an kernel error when wants to open a Word object. Anyone knows how could I resolve this problem ? Thanks a lot. Ruben
Identify Clients In Multithreaded Client Server Application
Hello everybody:
I am trying to create Multithreaded Client -Server application. Say 10 Clients connected to one server....I am looking for a way to identify each thread i.e. each client so that the server can identify each client individually and send information to each client if required or send information to all the ten clients at once.
Can anyone suggest me any ideas /references /pseudo code how to go about doing it.....
Thanks
Rahil
Record Locking With DAO
Hi guys, i am writting a program which uses MS access db, the program resides on the server computer and is accessed by about 5 machines simultaneously, all users read/write to teh DB. I already incorporated a simply mechanism that forbids the users to access teh same filed in teh record by assigning a special value to it, which means that the record is currently being edited, however if multiple users access the same feild with in 1 - 2 second difference then the database does not have a chance to update yet and multiple users are allowed to acces teh same record, which sometimes results in lost data due to overwrite.
What i need to know, if there is any way to lock a particular feild in teh record as soon as i access it.
Please help , thanx in advance
P.S: any other tips on how to structure a multiuser db which uses MS access and DAO would be greatly appreciated.
Record Locking
Hi all,
I am new arround here, and new in Visual Basic.
I have a question about record locking. I don't know of it's possible or how to do this. I'am using VB6, ADO and Access AND SQL-Server, it has to work on both databases.
I've read some threads here about Locking in Access, but i don't understand it
So my question, can someone give me an example of how to lock a record in VB with an AccessDB?
Thx in advance
Dees;
Record Locking
I created a new report, and everything works fine the code is below
Code:
Private Sub cmdFines_Click()
With degoodman
If .rsAmtOwed.State = adStateOpen Then
.rsAmtOwed.Close
End If
.rsAmtOwed.Open
If .rsAmtOwed.RecordCount > 0 Then
Set rptOwed.DataSource = degoodman
rptOwed.Show
.rsAmtOwed.Close
Else
MsgBox "No Records Found"
End If
End With
End Sub
Code:
Private Sub cmdEnter_Click()
If txtDate1.Text <> "" And txtDate2.Text = "" Then
With rptDocket
.DataMember = "SELECT * FROM CourtDocket WHERE CourtDate ='#" & txtDate1.Text & "#'"
rptDocket.Show
End With
ElseIf txtDate1.Text <> "" And txtDate2.Text <> "" Then
With rptDocket
.DataMember = "SELECT * FROM CourtDocket WHERE CourtDate BETWEEN '" & txtDate1.Text & "'" & " & txtdate2.text & "
rptDocket.Show
End With
Else
'With rptDocket
'.DataMember = "SELECT * FROM CourtDocket WHERE CourtDate = Date()"
rptDocket.Show
'End With
End If
End Sub
The problem I am having is when I end the program I am still seeing the "Microsoft Access Record Locking Information" icon...I am obviously not closing something...but, dunno what.
Record Locking
Hello,
I am currently using Microsoft Access 2000 has the backend data store for my front-end Visual Basic application.
I am currently adding and editing records once I receive all the values from the user. For example, if a user clicks “Add Record” and then enter details for the new record I only call the .Add method once I have all the values and they have been tested to be correct. But this is not helping me create a record locking attribute. The same thing goes with the Edit Dialog. I only change the values of the database when the user has entered all the details he wants changed and hits 'Save'.
How can I implement record locking, so that when one record is in use and is being edited another can't open or edit the record? I can only get this to work if I change everything to add and edit as a "on the go" basis, so as the user changes details the recordset is being modified. However, I don’t like to take this approach has it becomes to complex. I'd rather get all the details from the user, and then go and send an update query or modify the recordset object and then do an update on it.
I thought about adding a field named “In Use”, and everty time a user wants to access a record I simply check the value and it the record is available I mark it in use, and when the user close the dialog, I
Please provide some advice. Thanks in advance.
Visual Developer
Locking Record
hi...
i want to lock record.....
if user A open record and then user B open the same record, then user B will have read only for that record.
how can i know if user A already open that record, so user B just have read only for that record..
i'm already use AdLockPessimistic, but i still cannot know either,
as i know AdLockPessimistic is locking if that record is being edit and will release if found rs.Update.
when i select record :
dim rs as new adodb.recordset
private sub form_load()
if rs.state = 1 then rs.close
rs.open "select * from Contract where contratno = '12/2/2002/001' ",conn,adopenkeyset,adlockpessimistic,adcmdtext
'in this line, i want to know if that record is been open by another user, so i can display msgbox "Record is being open by another. Record is just for read only",vbinformation,, and then
because record is read only then
text1.enabled = false
text2.enabled = false
else
text1.enabled = true
text2.enabled = true
end if
end sub
i really need your help.....
thank's
DAO And Record Locking
I have an old (DAO) VB project which uses an Access MDB. There are multiple users using my program and I need to make a change to it.
I added a table with UserIDs in it and when a user connects to the db file they should get a free UserID and sets the UsedStatus field of the record to true. When they disconnect from the db file the UsedStatus is set to false again.
The problem is when 2 or more users at the same time connect to the DB the same UserID is used more then once.
Somehow I can't get the record locking to work properly.
This is what I did until now:
Code:
Private Sub Command1_Click()
Dim lCnt As Long
Dim bResult As Boolean
Dim dTimer As Double
Dim sKey As String
Do
bResult = getID(sKey)
If Not bResult Then
' There was a record lock
' Changing the caption to see how many times
' a lock occured
lCnt = lCnt + 1
Me.Caption = lCnt
dTimer = Timer
Do
DoEvents
Loop Until Timer - dTimer > 3
End If
Loop Until bResult And Len(sKey) > 0
End Sub
Private Function getID(ByRef myID As String) As Boolean
Dim myDB As DAO.Database
Dim myRST As DAO.Recordset
Dim mySQL As String
Dim bLocked As Boolean
On Error GoTo errHandler
mySQL = "SELECT * FROM ProINr WHERE ((ProjectTypeID) = 1 AND (UsedStatus) = False)"
Set myDB = OpenDatabase("d:sourceproregdbproreg.mdb")
DBEngine.Idle dbRefreshCache
Set myRST = myDB.OpenRecordset(mySQL, , dbPessimistic)
With myRST
.LockEdits = True
If Not .EOF Then
.MoveFirst
Do
.Edit
.Fields("UsedStatus").Value = True
myID = .Fields("UserID").Value
.Update
DBEngine.Idle dbForceOSFlush
Else
myID = "NOID"
End If
.Close
End With
myDB.Close
Set myRST = Nothing
Set myDB = Nothing
getID = True
Exit Function
errhandler:
getID = False
Set myRST = Nothing
Set myDB = Nothing
End Function
Sometimes it works sometimes it don't.
I tested it with multiple machines and sometimes the locking seems to work, but other times it's looping to wait until a record lock is released but after it's released it uses still the same record. As if the data in the mdb file is not updated yet.
Does anyone have a better method for locking/refreshing/update records in a MDB file?
Record Locking
Hello All
I am looking to program an application using Visual Basic 6 as my Front End. As a backend I will be using a Microsoft Access Database. I want to be able to lock an entire row when user accesses a record.
For example, I have table “Customers” which has 1000 customers in it. I have 3 employees which access this table at any one time. I want to be sure that if employee A, has record 154 open, that employee's B & C cannot, select, update, or delete anything from record 154 until user A has finished and closed the record.
How can I lock this one entire row with out locking the whole table?
Please advise
Thanks
Record Locking
I am a little confused :-)
In thread http://www.xtremevbtalk.com/showthread.php?t=231401
, it is said that with an MSAccess mdb there is no way to lock a record.
What is the use of adLockPessimistic for instance when opening a recordset?
Is it only applicable to databases other than MS Access?
Thanks for any insight :-)
Hervé Chain
Houston, Texas
Record Locking
hi pips.. i have created an inventory system for a company and it is installed in multiple computers connected to one database. my problem is that if one user is accessing a particular record in a certain table, how can i lock the record so that no one can access it and would only be free after the first user has finished using it.. please help.. thanks in advance..
Record Locking
Morning all.
Quick question ....
When updating or adding records into a table via VB, if I were to use
Code:
Sql = "update TABLEA set B = B + 1 where C = '1234'"
connUpdate.Execute Sql
rather than
Code:
Sql = "update TABLEA set B = B + 1 where C = '1234'"
Set rsUpdate = New ADODB.Recordset
cmdUpdate.CommandText = Sql: cmdUpdate.ActiveConnection = connUpdate
rsUpdate.Open cmdUpdate, , adOpenDynamic, adLockPessimistic
Set rsUpdate = Nothing
what are the benefits and/or pitfalls ?
I realise that not defining a recordset for updates is neater, as its one less object to have to deal with, but how is locking handled in the first example ?
Is it just determined by the server ?
Apologies if all this sounds obvious, but I just don't know.
Record Locking
I have an Access XP database that is split with forms and reports
in the front end database and the data tables in the back end
database. The issue just started occurring when a user edits a
record and another user tries to edit the same record they can
not. The locking is set to "Edited Record" and recordset type
is "Dynaset" and "Allow Edits" set to yes.
To me this seems correct, but they insist that it wasn't this way
before. I had saved a copy before I added a new field to the back
end db. If I open up the original database the issue happens too.
Is there a setting that I can change to allow edits without having
one user overwritting anothers data?
Record Locking
Our system has a sequence table . When multi users use the database it sometimes it throws back a error as a dupilcate value from the sequence has been used. Record locking doesnt seem to stop the error.
Record Locking
I have a single user application that i have developed for a friend of mine. They now wish to access it from two computers instaed of just one. I have networked the two computers together and they are both looking at the same database. I have added a field called LockedDateTime to the customers table and when a customer is edited i set this to the current day and time. If it has already been set then i simply display a message box indicatiing that another user is editing the customer. As the customer is saved i then clear the lockeddatetime allowing the other user to edit the customer. All sounds interesting but a problem arises when from the two you computers you access the same record only say a second apart the the following message is displayed
"Row cannot be located for updating", The actual problem as i see it is the lockaed date has been set by the first user but not written back to the server so user two thinks the records is'nt locked. It all works fine if i wait around 4 secs.
Please Help !!!
Record Locking
what i need to do is, when a record is displayed on a form and then the user wants to edit the record, i need to lock the record so no other users can edit the record at the same time. I am using the latest version of ADO.
Has anyone got some ideas for the best way to handle this situation.
Thanks
Simon
Locking A Certain Record
Hi I would like to ask for your help cause I'm doing a accounting system, I'm using a Visual Basic 6.0 Language and I'm connected to a SQL Server.
How can i Lock a record which is, it needs to achieve a condition
Record Locking
Greetings,
Hopefully this will be an easy answer for you VB pros out there:
I am creating an app that will use a shared database to furnish many users with information. The user will be allowed to add and edit the information contained therein.
I am using DAO against Access 2000. I am also using a class to retrieve the record from the DB. I can pass the class a value (ClientID) and it 'knows' how to populate itself with the record. As soon as it's populated, the connection to the DB is closed.
Here's the problem: How do I ensure that the information written to the database by one user will not overwrite any changes made to the same data by another user?
Eagerly awaiting any suggestions,
Guru2B
ADO Record Locking
A record is locked when stepping through a database via a VB ADO recordset and an event changes a field on the record.
This could be a user changing a field in a simple one record at a time form.
My question is...how do I check for the record lock state on a record? If the recordset is adLockOptimistic I need to check for the error lock after the user has changed a field, if the recordset is adLockPessimistic I need to check for a lock error as soon as the record becomes current in a recordset.
How do I achieve this?
Dazed and confused
Record Locking.
using ado, how should i explicitly lock a certain record before editing it so other users will not be able to edit the same record. is there a function that would place lock a record on a record and will return a value if the lock is successful?
as an example, i'm using msaccess database and i have a table named "Parameters" with a field Counter (numeric). This counter will increment and the value will be assigned to a certain record on two tables "Transactions1" and "Transactions2". To ensure that there would be noduplicate assignments, a record on "Transactions1" who needs a number on the "Parameters" table will first check if Counter is locked by a record on "Transaction2", if not, it will lock it, increment the Counter, take the value, then unlock it.
I don't know if this technique is wise or if you have something else in mind i would be willing to apply it.
thank you all!
Again Record Locking...
Guys one more....................
do i need to do this
i mean cancel update and close the table and open again or just do retry updation in the timer
The lines in Blue are the one i am confused about should be there or no
/////////////////////////////////////////CODE//////////////////////////////////////////////
ErrHandler:
With de.rsTblFGrading
.CancelUpdate
.Close
.Open
End With
Timer.Enabled = True
Timer.Interval = 1000
End Sub
Private Sub Timer_timer()
de.rsTblFGrading.Update
End Sub
/////////////////////////////////////////CODE//////////////////////////////////////////////
Also please let me know if after that again locking error comes then what should i do?
Thanks,
Zulqarnain Ali
|