[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[al8] 020 - TCP
"Find out how many TCP connections we can make"
| host port connections ip |
host := 'google.com'.
port := 80.
connections := #().
[true] whileTrue: [ | tcp |
ip := ip isNil ifTrue: [ host ] ifFalse: [ ip ].
tcp:= Lua socket tcp.
(tcp connect: ip port: port) ifFalse: [
^self note: 'Connection failed #'
,connections size
].
connections add: tcp.
self note: 'connection to ' ,ip ,' #' ,connections size.
ip = host ifTrue: [
ip := tcp peername.
self note: host ,' resolved to ', ip asLiteral.
ip := ip first.
].
connections size > 900 ifTrue: [
^self note: ' OK - near 1k connection the app can crash with FORTIFY: FD_SET: file descriptor 1024 >= FD_SETSIZE 1024'
]
]