session#

ansys.edb.core.session.session(ansys_em_root, port_num=None, ip_address=None, dump_traffic_log=False, use_shared_memory_ipc=False)#

Launch a local session to an EDB API server in a context manager.

Parameters:
ansys_em_rootstr

Directory where the EDB_RPC_Server.exe file is installed.

port_numint or None, default: None

Port number to listen on. The default is None, in which case a port in [50051, 60000] is selected.

ip_addressstr or None, default: None

IP address where the server executable file is running. The default is None, in which case localhost is used.

Note

This parameter is currently not supported. In future releases, this parameter is to support remotely running the API on another machine.

dump_traffic_logbool, default: False

Flag indicating if the network traffic log should be dumped when the session is disconnected.

use_shared_memory_ipcbool, default: False

Flag indicating if shared-memory IPC should be used for client/server communication. When True, data is transferred via a shared memory region instead of over the network, which can significantly boost performance for large data transfers. If the installed server does not support shared memory, the session falls back to standard gRPC communication automatically.

Examples

Create a session that automatically disconnects when it goes out of scope.

>>> with session("C:\\Program Files\\AnsysEM\\v231\\Win64", 50051):
>>> # program goes here