tryListen() — vite Function Reference
Architecture documentation for the tryListen() function in http.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 42db6b86_156c_c702_dc0d_98ceb7dfb6c1["tryListen()"] 695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"] 42db6b86_156c_c702_dc0d_98ceb7dfb6c1 -->|defined in| 695bc011_d16d_4322_2fef_1a59a092ee32 985bbb1d_5299_33eb_c131_28499ef4678b["isPortAvailable()"] 985bbb1d_5299_33eb_c131_28499ef4678b -->|calls| 42db6b86_156c_c702_dc0d_98ceb7dfb6c1 19009191_26ac_2526_d048_41ac02638e55["createServer()"] 42db6b86_156c_c702_dc0d_98ceb7dfb6c1 -->|calls| 19009191_26ac_2526_d048_41ac02638e55 style 42db6b86_156c_c702_dc0d_98ceb7dfb6c1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/http.ts lines 177–189
function tryListen(port: number, host: string): Promise<boolean> {
return new Promise((resolve) => {
const server = net.createServer()
server.once('error', () => {
// Ensure server is closed even on error to prevent resource leaks
server.close(() => resolve(false))
})
server.once('listening', () => {
server.close(() => resolve(true))
})
server.listen(port, host)
})
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does tryListen() do?
tryListen() is a function in the vite codebase, defined in packages/vite/src/node/http.ts.
Where is tryListen() defined?
tryListen() is defined in packages/vite/src/node/http.ts at line 177.
What does tryListen() call?
tryListen() calls 1 function(s): createServer.
What calls tryListen()?
tryListen() is called by 1 function(s): isPortAvailable.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free