Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8095413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:07:15+00:00 2026-06-05T21:07:15+00:00

Having a simple Akka HTTP server: package org.package.some import akka.actor.{IOManager, IO, Actor} import java.net.InetSocketAddress

  • 0

Having a simple Akka HTTP server:

package org.package.some

import akka.actor.{IOManager, IO, Actor}
import java.net.InetSocketAddress

class HttpServerActor extends Actor {    
  val state = IO.IterateeRef.Map.async[IO.Handle]()(context.dispatcher)

  override def preStart() {
    IOManager(context.system) listen new InetSocketAddress(8000)
  }

  def receive = {
    case IO.NewClient(server) =>
      val socket = server.accept()
      state(socket) flatMap (_ => RequestProcessor.processRequest(socket))

    case IO.Read(socket, bytes) =>
      state(socket)(IO Chunk bytes)

    case IO.Closed(socket, cause) =>
      state(socket)(IO EOF None)
      state -= socket

    case "STOP" => 
      println("WHAT'S HERE??")
  }
}

How would one stop the server, i.e. close server socket on port 8000?

Just killing the actor does not have any effect: there remains a line in netstat -a | grep 8000 saying that the port is still being listened to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:07:18+00:00Added an answer on June 5, 2026 at 9:07 pm

    IOManager.listen returns a ServerHandle, which has a close method.

    class HttpServerActor extends Actor {
      val state = IO.IterateeRef.Map.async[IO.Handle]()(context.dispatcher)
      var handle: ServerHandle = _
    
      override def preStart() {
        handle = IOManager(context.system) listen new InetSocketAddress(8000)
      }
    
      def receive = {
        // ...
        case "STOP" => 
          handle.close()
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 32 bit .NET class library having a simple public class and
Having a simple Python class like this: class Spam(object): __init__(self, description, value): self.description =
I'm having a simple ASP.NET application hosted on my local IIS6, under Vista. It
Does this make sense ? Having a simple class class Test { public Test()
I am trying to consume the .net webservice from cold fusion. Methods having simple
I am having some serious problem here. When do we need a class exactly?
I am having a simple HTML table with dynamic data generated from Server side.
i am having some simple problem in objective c maybe you can help .
I am having simple code of paralellizing QuickSort algorithm in Java, in run method
I having trouble with a simple question : How to have some disabled field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.