2014-01-22 3 views
3

새로운 Arduino Uno + WifiShield에 문제가 있습니다. http://arduino.cc/en/Tutorial/WiFiChatServerArduino Uno + WifiShield : 텔넷 오류 "Connection Refused"

내가 제외하고는 변경하지 않았다

#include <SPI.h> 
#include <WiFi.h> 

char ssid[] = "ssid"; // your network SSID (name) 
char pass[] = "password"; // your network password (use for WPA, or use  as key for WEP) 

int keyIndex = 0;   // your network key Index number (needed only for WEP) 

int status = WL_IDLE_STATUS; 

WiFiServer server(23); 

boolean alreadyConnected = false; // whether or not the client was connected previously 

void setup() { 
    //Initialize serial and wait for port to open: 
    Serial.begin(9600); 
    while (!Serial) { 
    ; // wait for serial port to connect. Needed for Leonardo only 
    } 

    // check for the presence of the shield: 
    if (WiFi.status() == WL_NO_SHIELD) { 
    Serial.println("WiFi shield not present"); 
    // don't continue: 
    while(true); 
    } 

    // attempt to connect to Wifi network: 
    while (status != WL_CONNECTED) { 
    Serial.print("Attempting to connect to SSID: "); 
    Serial.println(ssid); 
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:  
    status = WiFi.begin(ssid, pass); 

    // wait 10 seconds for connection: 
    delay(10000); 
    } 
    // start the server: 
    server.begin(); 
    // you're connected now, so print out the status: 
    printWifiStatus(); 
} 


void loop() { 
// wait for a new client: 
    WiFiClient client = server.available(); 


    // when the client sends the first byte, say hello: 
    if (client) { 
    if (!alreadyConnected) { 
     // clead out the input buffer: 
     client.flush();  
     Serial.println("We have a new client"); 
     client.println("Hello, client!"); 
     alreadyConnected = true; 
    } 

    if (client.available() > 0) { 
     // read the bytes incoming from the client: 
     char thisChar = client.read(); 
     // echo the bytes back to the client: 
     server.write(thisChar); 
     // echo the bytes to the server as well: 
     Serial.write(thisChar); 
    } 
    } 
} 


void printWifiStatus() { 
    Serial.print("SSID: "); 
    Serial.println(WiFi.SSID()); 

    // print your WiFi shield's IP address: 
    IPAddress ip = WiFi.localIP(); 
    Serial.print("IP Address: "); 
    Serial.println(ip); 

    // print the received signal strength: 
    long rssi = WiFi.RSSI(); 
    Serial.print("signal strength (RSSI):"); 
    Serial.print(rssi); 
    Serial.println(" dBm"); 
} 

당신은 또한 여기에 코드를 조회 할 수 있습니다 나는 arduino.cc 또는 아두 이노-IDE "WifiChatServer"이 제공하는 예제 코드를 테스트하려면 집에 Wi-Fi 연결 데이터를 입력합니다. 코드를 내 arduino에 업로드 한 후 컨트롤러가 Wi-Fi에 연결하고 라우터에서 지정한 IP 주소를 인쇄합니다. 또한 arduino는 라우터의 연결된 장치 표에 나열되어 있습니다.

내 노트북에서 arduino를 핑 (ping)하면 성공합니다!

텔넷 (putty)을 통해 arduino에 연결하려고하면 "Connection Refused"오류가 표시됩니다. 내 노트북에서 다른 포트 (8888/9999) 및 스마트 폰과 함께 동일한 오류가 발생할 때마다 비활성화 된 방화벽으로 연결을 시도했습니다. http://imagizer.imageshack.us/v2/800x600q90/34/ayo5.png

는 사람은 누구나 문제를 해결하기 위해 아이디어 :

다음은 간단한 핑 (ping) 및 텔넷 요청의 Wireshark를 캡처이야?

답변

2

나는 (공식 wifi 방패로) 유사한 문제가 있었다. 이전 버전의 Arduino IDE를 사용하여 해결했습니다. 나는 1.0.5에서 1.0.3으로 다운 그레이드했고 효과가 있었다. 아마도 당신도 같은 문제가 있습니까?

시도해 볼 가치가 있습니다.

+2

설명 할 수는 없지만 똑같은 코드로 작동했습니다. 최고로 부조리가 있습니다. 팁을위한 Thx ;-) – JU5T1C3

0

Arduino 1.05를 사용하면 동일한 문제가 발생합니다. 방금 Arduino 1.0.4에서 Arduino 1.0.5로 Wi-Fi 라이브러리를 복사했고 작동합니다.