Question

I have decided to move from SOAP servers to DataSnap servers & REST. I have viewed and followed several tutorials and even tried the DXE5 demos but I keep getting the same result. The issue is that I cannot connect the TSQLConnection on the client app to the DataSnap server that is running.

Here is the Code :

Socket Error # 10061
Connection refused..
OS = Windows 7 64bit
RAD Studio XE5 Update 2

Following DataSnap multi-tier video tutorial by Pawel Glowacki (and ohters).

In creating a Datasnap client/server app, I cannot connect the client TSQLConnection to the DSServer.

  1. The server is running (localhost)!

  2. Firewal de-activated.

  3. Added port 211 to Windows Firewall Inbound & Outbound rules.

  4. I have tried creating a DataSnat REST application and the same error occurs.

  5. I get the same results when doing this in DXE and DXE3.

Steps to reproduce

  1. Create Datasnap server (Tried both DataModule & DSServerModule).
  2. Leave default port to 211 (Have also tried several other ports (8080, 9000).
  3. Run the server. All is OK up to here.
  4. Create a VCL Form App.
  5. Add a TSQLConnection to Main form.
  6. Set driver to DataSnap.
  7. CommunicationProtocol = tcp/ip.
  8. DataSnapCOntext = datasnap/
  9. HostName = localhost (have tried 127.0.0.1 and my computer's IP address).
  10. LoginPropt = False.
  11. Run server.
  12. Start server.
  13. Open in browser works correctly.
  14. Set Connected property on TSQLConnection to true.
  15. Socket error 10061 is generated and I cannot get past this.

Here is the stack trace.

[5110E67F]{IndySystem190.bpl} IdStack.TIdStack.RaiseSocketError (Line 771, "IdStack.pas" + 42) + $21
[5110E606]{IndySystem190.bpl} IdStack.TIdStack.RaiseLastSocketError (Line 725, "IdStack.pas" + 1) + $F
[5110E571]{IndySystem190.bpl} IdStack.TIdStack.CheckForSocketError (Line 699, "IdStack.pas" + 2) + $3
[5110A9F4]{IndySystem190.bpl} IdStackWindows.TIdStackWindows.Connect (Line 1771, "IdStackWindows.pas" + 20) + $13
[50DF5849]{IndyCore190.bpl} IdSocketHandle.TIdSocketHandle.Connect (Line 294, "IdSocketHandle.pas" + 1) + $25
[50E01CF9]{IndyCore190.bpl} IdIOHandlerStack.TIdIOHandlerStack.ConnectClient (Line 344, "IdIOHandlerStack.pas" + 52) + $A
[50E05283]{IndyCore190.bpl} IdIOHandlerSocket.TIdIOHandlerSocket.Open (Line 332, "IdIOHandlerSocket.pas" + 13) + $4
[50E01011]{IndyCore190.bpl} IdTCPClient.TIdTCPClientCustom.Connect (Line 317, "IdTCPClient.pas" + 52) + $B
[16F76AFD]{IndyIPClient190.bpl} IPPeerClient.TIdTCPClientPeerIP.Connect (Line 1166, "IPPeerClient.pas" + 0) + $5
[520AC809]{DbxClientDriver190.bpl} Data.DbxSocketChannelNative.TDBXIdTCPLayer.Open (Line 378, "Data.DbxSocketChannelNative.pas" + 27) + $5
[520AC44B]{DbxClientDriver190.bpl} Data.DbxSocketChannelNative.TDBXSocketChannel.Open (Line 149, "Data.DbxSocketChannelNative.pas" + 13) + $E
[50059970]{rtl190.bpl  } System.@FreeMem (Line 4364, "System.pas" + 20) + $0
[50060DA0]{rtl190.bpl  } System.@UStrClr (Line 23846, "System.pas" + 14) + $0
[520AEA09]{DbxClientDriver190.bpl} Data.DBXTransportFilter.TDBXFilterSocketChannel.SetDBXProperties (Line 712, "Data.DBXTransportFilter.pas" + 8) + $10
[520AE999]{DbxClientDriver190.bpl} Data.DBXTransportFilter.TDBXFilterSocketChannel.Open (Line 693, "Data.DBXTransportFilter.pas" + 0) + $5
[520B0897]{DbxClientDriver190.bpl} Data.DBXClient.TDBXClientConnection.DerivedOpen (Line 430, "Data.DBXClient.pas" + 5) + $8
[5214F8D7]{DbxCommonDriver190.bpl} Data.DBXCommon.TDBXConnection.Open (Line 8599, "Data.DBXCommon.pas" + 5) + $4
[5214AC72]{DbxCommonDriver190.bpl} Data.DBXCommon.TDBXConnectionFactory.GetConnection (Line 6724, "Data.DBXCommon.pas" + 14) + $5
[5214AB6D]{DbxCommonDriver190.bpl} Data.DBXCommon.TDBXConnectionFactory.GetConnection (Line 6701, "Data.DBXCommon.pas" + 0) + $5
[51392D29]{dbexpress190.bpl} Data.SqlExpr.TSQLConnection.DoConnect (Line 2490, "Data.SqlExpr.pas" + 56) + $6
[50A8AA4D]{dbrtl190.bpl} Data.DB.TCustomConnection.SetConnected (Line 3482, "Data.DB.pas" + 8) + $4
[50128326]{rtl190.bpl  } System.TypInfo.SetOrdProp (Line 2583, "System.TypInfo.pas" + 21) + $1
[2110BA52]{designide190.bpl} DesignEditors.TPropertyEditor.SetOrdValue (Line 839, "DesignEditors.pas" + 2) + $E
[211564F7]{designide190.bpl} VCLEditors.TBooleanProperty.MouseUp (Line 1864, "VCLEditors.pas" + 5) + $10
[212A13CD]{vclide190.bpl} PropBox.TCustomPropListBox.ItemMouseUp (Line 1631, "PropBox.pas" + 17) + $1B
[212A15C3]{vclide190.bpl} PropBox.TCustomPropListBox.MouseUp (Line 1696, "PropBox.pas" + 1) + $D
[504634D8]{vcl190.bpl  } Vcl.Controls.TControl.DoMouseUp (Line 7468, "Vcl.Controls.pas" + 2) + $28
[50463554]{vcl190.bpl  } Vcl.Controls.TControl.WMLButtonUp (Line 7481, "Vcl.Controls.pas" + 9) + $6
[212A6D50]{vclide190.bpl} IDEInspListBox.TInspListBox.WMLButtonUp (Line 1632, "IDEInspListBox.pas" + 3) + $4
[50462B49]{vcl190.bpl  } Vcl.Controls.TControl.WndProc (Line 7224, "Vcl.Controls.pas" + 91) + $6
[1ECD5CD1]{cxLibraryRS19.bpl} dxHooks.TdxSystemHook.ProcessHookProcs$qqriuii + $99
[1ECD5A9A]{cxLibraryRS19.bpl} dxHooks.dxSystemGetMessageHook$qqsiuii + $16
[50466E9F]{vcl190.bpl  } Vcl.Controls.TWinControl.IsControlMouseMsg (Line 9807, "Vcl.Controls.pas" + 1) + $9
[50467669]{vcl190.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10039, "Vcl.Controls.pas" + 153) + $6
[5048AF69]{vcl190.bpl  } Vcl.StdCtrls.TCustomListBox.WndProc (Line 7108, "Vcl.StdCtrls.pas" + 55) + $5
[50466CAC]{vcl190.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 9751, "Vcl.Controls.pas" + 3) + $6
[501749C4]{rtl190.bpl  } System.Classes.StdWndProc (Line 17010, "System.Classes.pas" + 5) + $0
[5059214F]{vcl190.bpl  } Vcl.Forms.TApplication.CancelHint (Line 11117, "Vcl.Forms.pas" + 6) + $E
[50590DC3]{vcl190.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10288, "Vcl.Forms.pas" + 23) + $1
[50590E06]{vcl190.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 10318, "Vcl.Forms.pas" + 1) + $4
[50591141]{vcl190.bpl  } Vcl.Forms.TApplication.Run (Line 10456, "Vcl.Forms.pas" + 26) + $3

How can i do this ?

Was it helpful?

Solution

Make sure the ServerContainer data module is automatically created on start-up, or create it yourself.

OTHER TIPS

I was getting Socket Error #10061 with the wizard creating a DataSnap REST Client module (when testing the port 8080) on LocalHost

What I did is I ran the DataSnap REST Server application (.exe) and started it on LocalHost on port 8080. I added a new DataSnap REST Client Module. Tested the 8080 port and voilà ! it worked.

Solved it by adding a TDSTCPServerTransport component to my ServerContainer data module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top