Dear Sir/Madam I have a MCB1700 board and i want to control its LEDs via pc via TCP/ip.in order to do it i used LEDswitch program but i read the help and it suggests to use a specific windows application for control the LEDs via LAN cable and pc.in this case the board is a server and PC is a client. How can i find this windows application ? can i use command prompt window instead of windows application?if yes please help me how to use it. Also please give me some help for configuring my LEDswitch program codes on my board.
Thank you
http://www.keil.com/forum/57077
Please answer my question .I left this thread 3 days ago
Consider if you have any Anti-Virus or Firewalling that might preclude an application from opening sockets.
I turned off the windows firewall and anti virus,but the socket couldn't open and prior error appeared again.my windows is 7 .what should i check do you think?
So what are the IP settings on your computer? ipconfig
Are you using a router/switch? Are the addresses allocated via DHCP for your computer and the board?
Have you written any other socket based applications? Do they work?
Before writing your own, have you tried ready-made ones; eg
www.simplecomtools.com/.../viewPrd.asp
Do you have a basic (at least) understanding of how IP networks work?
Yes i familiar with ip network .also i have written a client and server socket program with C# and also i wrote a client socket program for android device and i can communicate with android device and my laptop and i would like to do the same with android device and my mcb1700. but in LEDSwitch.exe when i change the P2 value i have error(Couldn't connect.Please check the TCP/IP setting of your PC)
I set the IPV4 of my laptop to 192.168.2.10 and subnet mask 8.8.8.8 and set the following codes in my board:
#define _MAC1 0x1E // <o>Address byte 2 <0x00-0xff> // Default: 0x30 #define _MAC2 0x30 // <o>Address byte 3 <0x00-0xff> // Default: 0x6C #define _MAC3 0x6C // <o>Address byte 4 <0x00-0xff> // Default: 0x00 #define _MAC4 0xA2 // <o>Address byte 5 <0x00-0xff> // Default: 0x00 #define _MAC5 0x45 // <o>Address byte 6 <0x00-0xff> // Default: 0x01 #define _MAC6 0x5E // </h> // <h>IP Address // ============= // Local Static IP Address // Value 255.255.255.255 is not allowed. // It is a Broadcast IP address. // <o>Address byte 1 <0-255> // Default: 192 #define _IP1 192 // <o>Address byte 2 <0-255> // Default: 168 #define _IP2 168 // <o>Address byte 3 <0-255> // Default: 0 #define _IP3 2 // <o>Address byte 4 <0-255> // Default: 100 #define _IP4 12 #define _MSK1 8 // <o>Mask byte 2 <0-255> // Default: 255 #define _MSK2 8 // <o>Mask byte 3 <0-255> // Default: 255 #define _MSK3 8 // <o>Mask byte 4 <0-255> // Default: 0 #define _MSK4 8
i set the 192.168.2.12 in board ip text box and port number textbox to 1001 and choose TCP .I don't use any router because i directly connect the LAN cable to laptop and mcb1700.I wrote one client and one server socket application using C# and they are work correctly between two pc and also i wrote the client application for my android mobile phone and it can communicate with my PC very nice.Have you tried to control the mcb1700 with LEDSwitch.exe?
I set the IPV4 of my laptop to 192.168.2.10 and subnet mask 8.8.8.8 ...
Do you have any idea at all what the subnet mask is used for?
Subnet mask? Isn't that where you enter the IP of one of Google's DNS servers? :p
subnet mask is used for dividing a network to two or more network.in this case i could use 255.255.255.0 .but my issues doesn't solve with it.Do you have another idea?
i could use default number 255.255.255.0.but by this configuration my problem doesn't solve.Do you have any idea for solving the issue?
So you should be familiar with some tools & techniques for debugging IP network issues - what have you tried?
In particular, what have you done to determine whether this is a PC issue, an IP issue, or an issue at the mcb1700 end?
Is the cable correctly wired for that?
One suspects it's not a cross-over cable.
This is generally why I use a switch or router. And in circumstances where I want to monitor traffic I'd use an old HUB device which reflects traffic to another box for analysis, either just using a card in promiscuous mode, or a box running WireShark
subnet mask is used for dividing a network to two or more network.
Unfortunately it is clear that you know how the TCP/IP protocol stack uses the information.
Stop playing around with things you don't understand. Set it to what it was before. Otherwise you're likely to not see any success even if you were to find and fix the original problem.
yes.Also i used another cable but the problem wasn't solve
"yes. Also i used another cable but the problem wasn't solve"
Yes to what?
Perhaps you work with someone who has more Windows/IT/Networking experience? The guys with those Microsoft Certs rather than real engineering degrees.
Two PC/laptops connected through a switch would at least demonstrate network functioning, at the moment you have the system complaining TCP/IP networking doesn't work, and I haven't seen a IPCONFIG output suggesting otherwise.
I've got dozens of "other" ethernet cables, they are mostly all straight through as that's what people typically make/buy, I've got another box of "special" cross-over cables that do something else.
Is the cable correctly wired for that? i said yes to your question. i connect my LAN cable to two PCs and the communication was stablished then i disconnected it from PCs and connected it to mcb1700 and my laptop but LEDswitch.exe couldn't work and show me prior error.
But when i connect my Ethernet cable to mcb1700 and my laptop i can run HTTPDemo project on board and can simply control the board .Can you describe more about your own cross-over cable?
"Couldn't connect. Please check the TCP/IP setting of your PC"
But you've got source code for both ends of the transaction, can't you refine your understanding of the problem a little bit better? What errors/failures on the PC side would cause it to throw the error? Can you replicate that with WINSOCK based code that performs the equivalent function?
" i said yes to your question"
Well, you made a post that started with the word "yes" - but you didn't indicate what specific question it was in reply to!
" i connect my LAN cable to two PCs and the communication was stablished"
But do your PCs auto-detect the connection type...?
So why not use one of them to try to connect to the MCB1700 - and see what result you get?
Again, if you're familiar with this stuff you should be able to think of tools and techniques for debugging this kind of problem. What have you tried?
i set the ip for each PC and they can simply connect to each other via LAN cable.i think PC auto detect the connection type. i'm sure that the cable is OK.by the way what is your suggestion for connecting my pc to mcb1700 in order to control the LEDs? I couldn't use LEDSwitch.exe for control the LEDs with TCP and i faced with error.
Yes Pier i have LEDSwitch.exe C++ source code but it makes me complicated.I familiar with C# and can simply write a client server socket program with it but when i debug LEDSwitch.exe unfortunately can't find the problem.I haven't got any winsock app.Can you give me an application that i can test the TCP connection between PC and mcb1700?
You "think"? - don't you think that's something you need to check carefully and know for sure?!
"i'm sure that the cable is OK"
But "OK" for what, exactly?
Do you understand why a different cable might be required for connecting 2 devices directly - as opposed to via a switch/hub...?
-> But when i connect my Ethernet cable to mcb1700 and my laptop -> i can run HTTPDemo project on board and can simply control the board .
So, the hardware and cable is working fine.?
couldn't connect please check TCP/IP setting of your PC.
In the source of LEDSwitchDlg.cpp
static CString WSTITLE = _T("Ethernet Connection Error"); static CString WSERROR1 = _T("Failed to start Winsocket Connection.\nPlease check the settings of your network interface card!"); static CString WSERROR2 = _T("Couldn't get a socket.\nPlease check the TCP/IP settings of your PC!"); static CString WSERROR3 = _T("Couldn't connect.\nPlease check TCP/IP settings of your PC!"); static CString WSERROR4 = _T("Couldn't send complete data!");
if(connect(s,(struct sockaddr*)&sin,sizeof(sin)) == SOCKET_ERROR) { MessageBox(WSERROR3,WSTITLE, MB_OK | MB_ICONSTOP); WSACleanup(); return; }
It give you that err-msg, because connect() failed with SOCKET_ERROR. You should use C# to connect to MCB1700, and try your best.
What is the IP/MAC configured in HTTPDemo project?
John I can find these part of codes in LEDSwitch.exe but can't find when Socket_Error happend. why should i use C# ?why C++ programm doesn't work for me?Have you any C# socket app or I have to write my own C# codes? in HTTPDemo project i didn't change MAC but set the IP =192.168.2.12
Andrew I think when i can run HTTPDemo with the LAN cable it indicate that my LAN cable and hardware is fine and my problem is refer to software.why you suggest to use another type of cable?
Andrew I haven't use my own C# socket server program with mcb1700 so far.I should check it
View all questions in Keil forum