SmartCard.Transmit
------------------

Sends a service request to the smart card and expects to receive data back from the card.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SmartCard](component_SmartCard.md) | [6.3](newinversion63.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "SmartCard.Transmit"; SmartCardContext; SendHeader; SendBuffer; RecvLength ) 

**MBS**( **"SmartCard.Transmit";** /\* Sends a service request to the smart card and expects to receive data back from the card. \*/  
**$SmartCardContext**; /\* The smartcard context reference number. \*/   
**$SendHeader**; /\* The hex encoded protocol header structure for the instruction.  
This buffer is in the format of an SCARD\_IO\_REQUEST structure, followed by the specific protocol control information (PCI).  
For the T=0, T=1, and Raw protocols, the PCI structure is constant. The smart card subsystem supplies a global T=0, T=1, or Raw PCI structure, which you can reference by using the symbols T0, T1, and RAW respectively.  
With version 7.0 or newert this can be empty to use default header.e.g. "T1" \*/   
**$SendBuffer**; /\* The hex encoded data to be sent to the card.  
For T=0, the data parameters are placed into the address pointed to by pbSendBuffer according to the following structure:  
  
Type name Description  
Byte Cla The instruction class  
Byte Ins The instruction code   
Byte P1 Parameter to the instruction  
Byte P2 Parameter to the instruction  
Byte P3 Size of I/O transfer  
  
The data sent to the card should immediately follow the send buffer. In the special case where no data is sent to the card and no data is expected in return, P3 is not sent. \*/   
**$RecvLength**) /\* The number of bytes for the receiving buffer.  
How many bytes the plugin allocates for the answer. Can be much bigger than what you expect.e.g. 1024 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| SmartCardContext | The smartcard context reference number. | $SmartCardContext |
| SendHeader | The hex encoded protocol header structure for the instruction.   This buffer is in the format of an SCARD\_IO\_REQUEST structure, followed by the specific protocol control information (PCI).   For the T=0, T=1, and Raw protocols, the PCI structure is constant. The smart card subsystem supplies a global T=0, T=1, or Raw PCI structure, which you can reference by using the symbols T0, T1, and RAW respectively.   With version 7.0 or newert this can be empty to use default header. | "T1" |
| SendBuffer | The hex encoded data to be sent to the card.   For T=0, the data parameters are placed into the address pointed to by pbSendBuffer according to the following structure:      Type name Description   Byte Cla The instruction class   Byte Ins The instruction code    Byte P1 Parameter to the instruction   Byte P2 Parameter to the instruction   Byte P3 Size of I/O transfer      The data sent to the card should immediately follow the send buffer. In the special case where no data is sent to the card and no data is expected in return, P3 is not sent. |  |
| RecvLength | The number of bytes for the receiving buffer.   How many bytes the plugin allocates for the answer. Can be much bigger than what you expect. | 1024 |

### Result

Returns Receive Buffer or error.

### Description

Sends a service request to the smart card and expects to receive data back from the card.  
Returns receive buffer hex encoded.  
  
see also  
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa379804(v=vs.85).aspx>  
  
You can use [SmartCard.TransmitReceiveHeader](SmartCardTransmitReceiveHeader.md) to return last Transmit's receive header.  
### Examples

Query serial number of card:

 MBS ( "SmartCard.Transmit"; $Context ; "0200000008000000"; "00ca018108"; 8 )  
Query version:

 MBS ( "SmartCard.Transmit"; $Context ; "0200000008000000"; "00ca018202"; 2 )  
Connect and query value:

 If \[MBS ( "[SmartCard.Available](SmartCardAvailable.md)" ) = 1\]  
 #Start a new session  
 Set Variable \[$SCContext ; Value:MBS ( "[SmartCard.Init](SmartCardInit.md)" )\]  
 If \[MBS ( "[SmartCard.Valid](SmartCardValid.md)"; $SCContext )\]  
 #Query list of readers and pick first  
 Set Variable \[$SCReader ; Value:GetValue ( MBS ( "[SmartCard.ListReaders](SmartCardListReaders.md)"; $SCContext ) ; 1 )\]  
 If \[MBS ("IsError") = 0\]  
 # Connect to card  
 Set Variable \[$SCConnect ; Value:MBS ( "[SmartCard.Connect](SmartCardConnect.md)"; $SCContext ; $SCReader ; "Shared"; "any")\]  
 Set Variable \[$PRotocol ; Value:MBS ( "[SmartCard.GetActiveProtocol](SmartCardGetActiveProtocol.md)"; $SCContext )\]  
 If \[$SCConnect = "OK"\]  
 #Run a query  
 Set Variable \[$Result ; Value:MBS ( "SmartCard.Transmit"; $SCContext ; "0200000008000000"; "00ca018202"; 512 )\]  
 #Result is 4 bytes. Starts with C901 for Version 5.0 or C903 for Version 5.3   
 Show Custom Dialog \["Version"; $result \]  
 #Disconnect  
 Set Variable \[$SCDisconnect ; Value:MBS ( "[SmartCard.Disconnect](SmartCardDisconnect.md)"; $SCContext ; "Leave" )\]  
 Else  
 Show Custom Dialog \["Error"; "No card available."\]  
 End If  
 End If  
 #End Card Session  
 Set Variable \[$SCRelease ; Value:MBS ( "[SmartCard.Release](SmartCardRelease.md)" ; $SCContext )\]  
 Else  
 Show Custom Dialog \["Error"; "Failed to initalize"\]  
 End If  
Else  
 Show Custom Dialog \["Error"; "No SmartCard API on this OS."\]  
End If  
Transmit select file commands to go into folder for EID cards:

 # select folder 3F00   
Set Variable \[ $r ; Value: MBS ( "SmartCard.Transmit"; 58001; "T1"; "00A4020C023F0000"; 200 )\]  
\# select subfolder DF 01   
Set Variable \[ $r ; Value: MBS ( "SmartCard.Transmit"; 58001; "T1"; "00A4020C02DF0100"; 200 )\]  
\# now do readfile of 4031   
Reset card:

 MBS ( "SmartCard.Transmit"; $Context ; "0200000008000000"; "0000000000"; 0 ) // reset command is all zero.  
### See also

- [IsError](IsError.md)
- [SmartCard.Available](SmartCardAvailable.md)
- [SmartCard.Connect](SmartCardConnect.md)
- [SmartCard.GetActiveProtocol](SmartCardGetActiveProtocol.md)
- [SmartCard.Init](SmartCardInit.md)
- [SmartCard.ReadFile](SmartCardReadFile.md)
- [SmartCard.Release](SmartCardRelease.md)
- [SmartCard.TransmitReceiveHeader](SmartCardTransmitReceiveHeader.md)
- [SmartCard.Valid](SmartCardValid.md)
- [Version](Version.md)

### Release notes

- **Version 7.0**
    - Made SendHeader parameter optional for [SmartCard.Transmit](http://www.mbsplugins.eu/SmartCardTransmit.shtml).

### Example Databases

- [SmartCard/Belgian EID Reader](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SmartCard/Belgian%20EID%20Reader.shtml#2ScriptAnchor_)
- [SmartCard/SmartCard ReadFile](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SmartCard/SmartCard%20ReadFile.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 7.0pr4](https://www.mbsplugins.de/archive/2017-01-19/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.4pr3](https://www.mbsplugins.de/archive/2016-08-08/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [Talking to a SmartCard in FileMaker Pro](https://www.mbsplugins.de/archive/2016-08-03/Talking_to_a_SmartCard_in_File/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 13th June 2016 , last changed 25th February 2026

  
[SmartCard.Status](SmartCardStatus.md) - [SmartCard.TransmitReceiveHeader](SmartCardTransmitReceiveHeader.md)

[HTML Version](SmartCardTransmit.shtml)