---
title: "makeReadSource(fileDescriptor:queue:)"
framework: dispatch
role: symbol
role_heading: Type Method
path: "dispatch/dispatchsource/makereadsource(filedescriptor:queue:)"
---

# makeReadSource(fileDescriptor:queue:)

Creates a new dispatch source object for reading bytes from the specified file.

## Declaration

```swift
class func makeReadSource(fileDescriptor: Int32, queue: DispatchQueue? = nil) -> any DispatchSourceRead
```

## Parameters

- `fileDescriptor`: A file descriptor pointing to an open file or socket. The dispatch source begins reading at the file descriptor’s current location.
- `queue`: The dispatch queue to which to execute the installed handlers.

## Return Value

Return Value A dispatch source object that conforms to the DispatchSourceRead protocol.

## Discussion

Discussion After creating the dispatch source, use the methods of the DispatchSourceProtocol protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its activate() method. As the system reads the contents of the file or socket, it calls your event handler to process the bytes.

## See Also

### Creating a File System Source

- [makeWriteSource(fileDescriptor:queue:)](dispatch/dispatchsource/makewritesource(filedescriptor:queue:).md)
- [makeFileSystemObjectSource(fileDescriptor:eventMask:queue:)](dispatch/dispatchsource/makefilesystemobjectsource(filedescriptor:eventmask:queue:).md)
- [DispatchSourceRead](dispatch/dispatchsourceread.md)
- [DispatchSourceWrite](dispatch/dispatchsourcewrite.md)
- [DispatchSourceFileSystemObject](dispatch/dispatchsourcefilesystemobject.md)
- [DispatchSource.FileSystemEvent](dispatch/dispatchsource/filesystemevent.md)
