# Issue while connecting the client to the server

**URL:** <https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273>\
**Category:** Flower Help - Beginners\
**Created:** [July 17, 2024, 5:12pm UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273 "2024-07-17T17:12:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![priya04119961870](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@priya04119961870](https://discuss.flower.ai/u/priya04119961870)\
**Post date:** [July 17, 2024, 5:12pm UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273/1 "2024-07-17T17:12:11Z")

</div>

grpc.\_channel.\_InactiveRpcError: \<\_InactiveRpcError of RPC that terminated with:  
status = StatusCode.UNAVAILABLE  
details = “failed to connect to all addresses; last error: UNAVAILABLE: ipv4:0.0.0.0:9092: WSA Error”  
debug\_error\_string = “UNKNOWN:Error received from peer {created\_time:“2024-07-17T02:32:08.5763354+00:00”, grpc\_status:14, grpc\_message:“failed to connect to all addresses; last error: UNAVAILABLE: ipv4:0.0.0.0:9092: WSA Error”}”

> 

Please someone help how to fix this issue.

---

<div class="post-metadata">

**Author:** ![adam-narozniak](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/adam-narozniak/32/33_2.png) [@adam-narozniak](https://discuss.flower.ai/u/adam-narozniak)\
**Post date:** [July 22, 2024, 1:41pm UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273/2 "2024-07-22T13:41:51Z")

</div>

Hi,  
Could you provide the code that caused that problem?

---

<div class="post-metadata">

**Author:** ![priya04119961870](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@priya04119961870](https://discuss.flower.ai/u/priya04119961870)\
**Post date:** [July 26, 2024, 1:10am UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273/3 "2024-07-26T01:10:52Z")

</div>

from flwr.client import ClientApp, NumPyClient

from task import (  
Net,  
DEVICE,  
load\_data,  
get\_weights,  
set\_weights,  
train,  
test,  
)

# Load model and data (simple CNN, CIFAR-10)

net = Net().to(DEVICE)  
trainloader, testloader = load\_data()

# Define FlowerClient and client\_fn

class FlowerClient(NumPyClient):  
def fit(self, parameters, config):  
set\_weights(net, parameters)  
results = train(net, trainloader, testloader, epochs=1, device=DEVICE)  
return get\_weights(net), len(trainloader.dataset), results

```
def evaluate(self, parameters, config):
    set_weights(net, parameters)
    loss, accuracy = test(net, testloader)
    return loss, len(testloader.dataset), {"accuracy": accuracy}

```

def client\_fn(cid: str):  
“”“Create and return an instance of Flower `Client`.”“”  
return FlowerClient().to\_client()

# Flower ClientApp

app = ClientApp(  
client\_fn=client\_fn,  
)

# Legacy mode

if **name** == “ **main** ”:  
from flwr.client import start\_client

```
start_client(
    server_address="127.0.0.1:9092",
    client=FlowerClient().to_client(),
    insecure=True, # Assuming you want to run in insecure mode
    superlink="127.0.0.1:9092" # Use superlink instead of server
)

```

---

<div class="post-metadata">

**Author:** ![charles](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/charles/32/92_2.png) [@charles](https://discuss.flower.ai/u/charles)\
**Post date:** [July 28, 2024, 10:42am UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273/4 "2024-07-28T10:42:34Z")

</div>

Hi @priya04119961870, did you first start the server before starting the client?

---

<div class="post-metadata">

**Author:** ![priya04119961870](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@priya04119961870](https://discuss.flower.ai/u/priya04119961870)\
**Post date:** [July 29, 2024, 1:23am UTC](https://discuss.flower.ai/t/issue-while-connecting-the-client-to-the-server/273/5 "2024-07-29T01:23:57Z")

</div>

Yes I did start the server…  
still was facing the WSA issue
