File tree Expand file tree Collapse file tree 1 file changed +1
-27
lines changed
Expand file tree Collapse file tree 1 file changed +1
-27
lines changed Original file line number Diff line number Diff line change @@ -280,32 +280,6 @@ let icmpPacket = createICMPPacket() // Your ICMP packet data
280280try await socket.write (icmpPacket)
281281```
282282
283- ## Error Handling
284-
285- Socket operations throw ` SocketError ` which conforms to Swift's ` Error ` protocol:
286-
287- ``` swift
288- import Socket
289-
290- do {
291- let socket = try await Socket (IPv4Protocol.tcp )
292- try await socket.connect (to : address)
293- } catch let error as SocketError {
294- switch error.code {
295- case .connectionRefused :
296- print (" Connection refused by server" )
297- case .networkUnreachable :
298- print (" Network is unreachable" )
299- case .timeout :
300- print (" Operation timed out" )
301- default :
302- print (" Socket error: \( error ) " )
303- }
304- } catch {
305- print (" Unexpected error: \( error ) " )
306- }
307- ```
308-
309283## Requirements
310284
311285- Swift 5.7+
@@ -317,4 +291,4 @@ Contributions are welcome! Please feel free to submit a Pull Request.
317291
318292## License
319293
320- This project is licensed under the MIT License - see the LICENSE file for details.
294+ This project is licensed under the MIT License - see the LICENSE file for details.
You can’t perform that action at this time.
0 commit comments