Skip to main content

Assetto Corsa UDP Client

Project description

# ACUDPClient

[![Build Status](https://travis-ci.org/joaoubaldo/acudpclient.svg?branch=master)](https://travis-ci.org/joaoubaldo/acudpclient)

ACUDPClient is module that can be used to communicate with an Assetto Corsa
server using its UDP protocol.


## Installation

```bash
$ python setup.py install
```

or

```bash
$ pip install acudpclient
```

(virtualenv is recommended)


## Testing
```bash
$ nosetests
```

## Usage

Server events can be handled manually or using subscribers by calling
client's `get_next_event()` method.

When creating a subscriber implement methods for events that need to be
handled using the following naming scheme `on_<event_type>(self, event)`
where `event_type` is any of the types found in
`acudpclient.types.ACUDPProtoTypes` class (see Usage).


Manually handle events:
```python
from acudpclient.client import ACUDPClient

client = ACUDPClient(port=10000, remote_port=10001)
client.listen()

while True:
event = client.get_next_event(call_subscribers=False)
print event
```


Handle events with a subscriber:
```python
from acudpclient.client import ACUDPClient


class ACEventHandler(object):
def on_ACSP_LAP_COMPLETED(self, event):
print event

def on_ACSP_NEW_SESSION(self, event):
print event

def on_ACSP_NEW_CONNECTION(self, event):
print event


handler = ACEventHandler()
client = ACUDPClient(port=10000, remote_port=10001)
client.listen()
client.subscribe(handler)

while True:
client.get_next_event()
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for acudpclient, version 0.9.5
Filename, size File type Python version Upload date Hashes
Filename, size acudpclient-0.9.5.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page