I have a desktop application which use MySQL database. The application worked fine unless I add a new dependency which is a dll library which communicates with special hardware using socket. This new library call WSAStartup and WSACleanup to start and stop communication with the hardware.
But sometimes the connection to MySQL database is interrupted as well.
What are the guidelines for application which use more than one dependency working with winsockets?
Should these libraries call WSAStartup and WSACleanup?
Related
I have two independent applications (cocoa), one main, the other slave.
The main application application is embedding a XPCService, which is correctly launched when the application is opened. No problems so far for connecting and exchanging data with that service (I also see this XPCService in the Activity Monitor).
But I want the other slave application to connect and send data to that XPC Service (and then to the main first application) after it has been launched by the main one.
Using NSXPCConnection (with initWithMachServiceName), and the correct Service bundle identifier doesn't work: no NewConnection delegate is called so the slave application never reach the service.
What am I missing ? Is what I want is possible with NSXPCConnection ?
Is it because I need the XPCService (within plist) to be shared in some way ? In that case what should I do ?
I can't find any information about this sort connection !
Thanks a lot for your help !
"I have two independent applications "
As stated in Apple's Documentation for XPC:
an XPC service is private, and is available only to the main application that contains it.
For security, an application that contains an XPC helper app gets signed to ensure that only the main application is allowed to call up on its helper.
However, it should be noted that the documentation also states
A connection is a virtual endpoint; it is independent of whether an actual instance of the service binary is running. The service binary is launched on demand.
A connection can also be sent as a piece of data in an XPC message. Thus, you can pass a connection through XPC to allow one service to communicate with another service (for example).
Though I've not seen this in practice, it does imply that you may be able to initiate the connection from the main application to the XPC helper and send this connection to your 'slave' app.
I recently going through some code in my project and found that the server DLL has implemented an interface IConnectionPointContainerImpl.
I want to know how it works internally to callback a method of client (EXE) from server (COM component) DLL.
How does COM connection point work to make a callback internally from a server DLL to client EXE.
We have a legacy vb6 automation application that communicate over a sockets on need basis.
But opening and establishing connection (only when required) to the remote port taking more time frequently.
So,i am planning to write other application (say a socket server) that opens the required sockets and keep the connections alive.This application will write connected socket handle values to a file or database.
Is it possible in vb6 to create a socket object using socket handle from the already opened socket that was owned by other process (socket server application in this case)?
This is exactly the type of situation that WSADuplicateSocket() is intended for.
Your "server" can create a socket and use WSADuplicateSocket() to fill a WSAPROTOCOL_INFO record that describes the socket. The "server" can then expose the WSAPROTOCOL_INFO to your VB app using any IPC mechanism you want. The VB app can pass the WSAPROTOCOL_INFO to WSASocket() to access the socket and use it as needed.
No, Windows sockets cannot be shared cross-process, not even through handle inheritance (this is because although it is usually a handle, an LSP might return something that is not a handle and thus not inherited). You should make one process open and maintain the connection and the others talk to that process to communicate with the server.
A JDBC driver implementation provides the low level details that allows a client to communicate with a third party datababase. I am just curious what it is doing behind the scenes. Communication between two systems written in different languages usually happens through web services.
Does the jdbc driver use web services to communicate between the client and the db server? Or am i oversimplifying?
People who write JDBC drivers have several options to choose from:
Type 1 driver: Use the generic JDBC-ODBC bridge, don't actually make a driver.
Type 2: Make a "wrapper" that uses JNI to call functions in a native client library.
Type 3: A generic driver that connects to a "middleware" service that talks with the database.
Type 4: a pure-Java implementation of the database communication protocol.
A type 3 driver might use web services to talk with the middleware. The other types of driver most likely communicate in a database-specific binary protocol over TCP/IP sockets (if the database is on a remote host) or other suitable reliable transport, not through web services.
You should check this link as this shows you how JDBC works.
Now coming to your question : No JDBC do not use web services. The way it connects to different types of databases is due to the database vendors because different database vendors provide their own driver implementation and you just need to use that implementation. There's nothing like web services. Each database vendor provides you with some api of their own to access database which they map to the Java's api to access database which is generic.
Java is provides a generic api for database operations which ultimately does operations and communication with database using sockets.
So what you need to read is TCP/IP , Socket programming, IO and JDBC. Please don't forget to check the link it will surely help you understand the concept.
I build a service used thrift, and host it on a tomcat server by TServlet , the protocol is TCompactProtocol
I want to test the service by loadrunner, but i don't know how to record the test script
What protocol you would select for your thrift interface testing is entirely dependent upon the transport used in your implementation
http://thrift.apache.org/docs/concepts/
If raw TCP, then Winsock. If HTTP, then Web Virtual User (with Web_custom_requests() and recording headers), etc....
Note, not all interfaces are recordable. Some you will have to build code directly. With Thirft you ~~may~~ be able to build a client using the Java template virtual user type.
If this is your first venture into sockets of Java virtual user types then you will want to have a mentor with you for the ride. Otherwise its going to be extremely painful and far less fruitful than it should be.