完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我使用PrimeV2.0和MPLAB V3.5与PIC32 MX795F512,我不能打开TCP客户端或服务器。我使用的是协调函数TCPIPpTCPPclitOnTune和TCPPIpTCP.Server开放。我会在***我的一些代码。客户端和服务器打开函数创建有效套接字,但它们从不找到和连接。我用TCPIPUTCPUISConnect测试连接,它只告诉我服务器正在监听,客户端正在等待连接。我已经尝试了TCPIPPTCP连接函数,并且在输出窗口(PIC AppIO窗口)中返回了一个“OpTCPPsEnthNoMeMyEnyError”与“在模块1行308中失败的188个字节的堆分配”。我尝试增加堆大小,但是在使用TCPIpU-TCPUnLink函数时,在运行时仍会同时获得这两个错误。我还尝试冲洗套接字以摆脱任何以前的传输包,但这并没有什么区别。我也有WiReHARK和运行,这表明没有数据包在所需端口上传输(这是有意义的,因为套接字没有连接)。我使用的是端口502(MOD总线)。我还遵循了TCPYServer客户端实例中的协调和它们的过程(在打开客户端之前解析DNS主机名到IPv4地址),但是它不起作用。RQStuts= TCPIpHIPTCPyclitOnPin(IpAdAddiSsSype Type IPv4,502,(IPX MululyAdvult*)和MRQIPToIP);MRQPROSTATOR= MRQYSTATEYCONtiON;} TCPIPPUTCPUFLISH(MRQStUB);如果(TCPIPPTCP连接(MRQSoT)){(TCPIpH-TCPI- ISCONNATION(MRQSOCK)){……/代码永远不会到达这里,有一些步骤缺少或需要为这些函数设置/配置的一些必要参数?我感谢任何帮助,因为我对TCPIP和互联网协议非常陌生。谢谢。
以上来自于百度翻译 以下为原文 Hello, I'm using hARMony V2.0 and MPLAB V3.5 with the PIC32MX795f512 and I can't seem to open a TCP client or server. I am using the harmony functions TCPIP_TCP_ClientOpen and TCPIP_TCP_ServerOpen. I will post some of my code below. The client and server open functions create valid sockets, but they never find and connect with each other. I test the connection with TCPIP_TCP_IsConnected which just tells me that the server is listening and the client is waiting to connect. I have tried the TCPIP_TCP_Connect function, and this returns a _TCP_SEND_NO_MEMORY error with "Heap allocation of 188 bytes failed in module 1 line 308" in the output window(PIC AppIO Window). I have tried increasing the heap size, but continue to get both errors during runtime when I use the TCPIP_TCP_Connect function. I have also tried flushing the socket to get rid of any previous transmitting packets, but that did not make a difference. I also have wireshark up and running which is showing no packets being transferred over the desired port (which makes sense because the sockets are not connected). I am using port 502 (Mod-bus). I have also followed the tcp_server_client examples in harmony and their procedure (resolving DNS host name to IPV4 Address before opening the client) but it doesn't work. /****part of code****/ if (TCPIP_STACK_READY()) { TCPIP_Helper_StringToIPAddress(MRQConfig.IPAddr, &mrqIPAddress); mrqSocket = TCPIP_TCP_ClientOpen(IP_ADDRESS_TYPE_IPV4, 502, (IP_MULTI_ADDRESS*)&mrqIPAddress); mrqPrevState = MRQ_STATE_CONNECT; } } TCPIP_TCP_Flush(mrqSocket); if (TCPIP_TCP_Connect(mrqSocket)) { if(TCPIP_TCP_IsConnected(mrqSocket)) { ..........//code never reaches here are there some steps I am missing or some necessary parameters that need to be set/configured for these functions to work? I appreciate any help as I am very new to TCPIP and internet protocols. Thanks. Attachment(s) TCP client_server.txt (0.43 KB) - downloaded 100 times |
|
相关推荐
6个回答
|
|
使用MHC配置TCP/IP协议栈吗?发送StysCyFig .h设置。您为项目分配了哪些堆?
以上来自于百度翻译 以下为原文 Do you configure the TCP/IP stack using MHC? Send the system_config.h settings. What heap do you have allocated for your project? |
|
|
|
|
|
|
|
嘿,我用MHC配置一切。下面是我的堆栈、堆和TCP的系统配置设置,定义了TCPIpHyStaskUsIIIPv4,定义了TCPIpthStaskUsIuxTCP定义了TCPPIpStaskUIsU.UDP,定义了TCPPIpStAcKyTigKyRead 5定义了TCPIpHyStaskSeCURURIONPORTA条目10 /*TCP/IP堆栈事件通知*/*定义TCPPIPS栈TypPixStaskyLoad操作定义TrpIpHyStaskyLoad操作true true定义TCPPIpStaskIfIpUpIONDULO操作true true定义TCPPIpStaskMaCyLoSux操作true true定义TCPIpH-StaskLyTypultSaveSealRealtrue /**TCPIP堆配置定义了TCPPIpStaskUsIUnLealAlxHEAP*定义TCPIpHyStaskFieldSmithSub 39250定义定义了TCPPIpTaskFraceRunx极限2048定义定义TCPIpH-StaskMalLogyFunc Malc定义定义了TCPPIpStaskCalOracle Func CaloC定义TCPPIpStaskFielfFunc定义TCPPIpx栈定义了TCPPIpStaskFraceTraceEngEnabl,定义了TCPPIpStaskFraceTraceSuxSysx 16定义了TCPIpH-StaskHeAPPU.Fig标志TCPIpH-StaskHeAPAPHeLAPAPI FraseLoCultOracle。定义了TCPPIpTcpMax SeGixSiZeZTX 1460×定义TCPIpH-TpPixMax SeGixSiZeRxx局部1460定义TCPPIpTcpMax SeGixSeZixRxxNOx局部536 536定义TCPPIpTCPOSoCKEL DeFultTxx大小512 512定义TCPPIpTCPOSoCKEL Debug txpx大小512TrpPipTcPixTypTimeTimeOutux定义了1000个字节,定义了TCPPIpTCP.DelayDeAkgTimeOutOUT 100定义TCPPIPTCPFIN WAITIG2YTIMEOUT 5000,定义TCPPIPTCPKEPEGYAVEVETIOUT 10000 O.定义TCPPIPTCP*TLUEXOWAITIGHOUTIOUT 200定义定义TCPPIpTCPpMax重试5π定义TCPIPpTCP.Max,unACKEDKEKEPYAVELVIES 6定义TCPPIpTcpMax,Sytha重试3个定义TCPPIpTCPUAutoPrimeTimeOutExvaya 40定义定义TCPPIpTCPIWONDOWOUPDATEY TimeOutoVA 200定义定义TCPPIpTCP*Max Sosikes 10定义定义TCPPIpTCPYTASKKTICKTRAIL 5定义TCPIPPTCPYMSLIGHTIMOUT 0定义了TCPPIpTCPIQuiTyTime0nKurZman,我使用了自己的自定义PCB
以上来自于百度翻译 以下为原文 Hey rainad, I configure everything using MHC. Here are my system config settings for STACK, HEAP and TCP: #define TCPIP_STACK_USE_IPV4 #define TCPIP_STACK_USE_TCP #define TCPIP_STACK_USE_UDP #define TCPIP_STACK_TICK_RATE 5 #define TCPIP_STACK_SECURE_PORT_ENTRIES 10 /* TCP/IP stack event notification */ #define TCPIP_STACK_USE_EVENT_NOTIFICATION #define TCPIP_STACK_USER_NOTIFICATION false #define TCPIP_STACK_DOWN_OPERATION true #define TCPIP_STACK_IF_UP_DOWN_OPERATION true #define TCPIP_STACK_MAC_DOWN_OPERATION true #define TCPIP_STACK_CONFIGURATION_SAVE_RESTORE true /*** TCPIP Heap Configuration ***/ #define TCPIP_STACK_USE_INTERNAL_HEAP #define TCPIP_STACK_DRAM_SIZE 39250 #define TCPIP_STACK_DRAM_RUN_LIMIT 2048 #define TCPIP_STACK_MALLOC_FUNC malloc #define TCPIP_STACK_CALLOC_FUNC calloc #define TCPIP_STACK_FREE_FUNC free #define TCPIP_STACK_DRAM_DEBUG_ENABLE #define TCPIP_STACK_DRAM_TRACE_ENABLE #define TCPIP_STACK_DRAM_TRACE_SLOTS 16 #define TCPIP_STACK_HEAP_USE_FLAGS TCPIP_STACK_HEAP_FLAG_ALLOC_UNCACHED #define TCPIP_STACK_HEAP_USAGE_CONFIG TCPIP_STACK_HEAP_USE_DEFAULT #define TCPIP_STACK_SUPPORTED_HEAPS 1 /*** TCP Configuration ***/ #define TCPIP_TCP_MAX_SEG_SIZE_TX 1460 #define TCPIP_TCP_MAX_SEG_SIZE_RX_LOCAL 1460 #define TCPIP_TCP_MAX_SEG_SIZE_RX_NON_LOCAL 536 #define TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE 512 #define TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE 512 #define TCPIP_TCP_DYNAMIC_OPTIONS true #define TCPIP_TCP_START_TIMEOUT_VAL 1000 #define TCPIP_TCP_DELAYED_ACK_TIMEOUT 100 #define TCPIP_TCP_FIN_WAIT_2_TIMEOUT 5000 #define TCPIP_TCP_KEEP_ALIVE_TIMEOUT 10000 #define TCPIP_TCP_CLOSE_WAIT_TIMEOUT 200 #define TCPIP_TCP_MAX_RETRIES 5 #define TCPIP_TCP_MAX_UNACKED_KEEP_ALIVES 6 #define TCPIP_TCP_MAX_SYN_RETRIES 3 #define TCPIP_TCP_AUTO_TRANSMIT_TIMEOUT_VAL 40 #define TCPIP_TCP_WINDOW_UPDATE_TIMEOUT_VAL 200 #define TCPIP_TCP_MAX_SOCKETS 10 #define TCPIP_TCP_TASK_TICK_RATE 5 #define TCPIP_TCP_MSL_TIMEOUT 0 #define TCPIP_TCP_QUIET_TIME 0 NKurzman I am using my own custom PCB |
|
|
|
你的项目有多大?试着把它和TCP/IP堆增加10 KB,看看会发生什么。如果你有一个附加的系统,你可以试试“HeAPFipe”和“Mac”命令。
以上来自于百度翻译 以下为原文 What heap do you have for your project? Try increasing it and the TCP/IP heap too by 10 KB, just to see what happens. If you have a serial console attached to your system, please try the "heapinfo" and "macinfo" commands. |
|
|
|
嘿,雷诺德,我去上班了。我的堆分配问题是因为我执行TCPIPPTCP连接方式太快和频繁。我所需要做的就是等待10-15秒,直到堆栈在调用TCPIPPUTCPUnLink之前完全运行并运行,在这种情况下,它成功了,并且套接字开始连接。我的程序不是很干净,我只是设置一个计数器以达到一个特定的值,但它似乎是上升和运行。谢谢你的帮助。
以上来自于百度翻译 以下为原文 Hey rainad, so I got it to work. My heap allocation problem was because I was performing TCPIP_TCP_Connect WAY too quickly and frequently. All I needed to do was wait 10-15 seconds until the stack was fully up and running before calling TCPIP_TCP_Connect in which case it was successful and the sockets became connected. My procedure is not very clean, I just set a counter to reach a specific value, but it seems to be up and running. Thanks for your help. |
|
|
|
很高兴听到它现在起作用。你可以使用TecPIPStaskNeTraseRead()调用而不是计数器。
以上来自于百度翻译 以下为原文 Good to hear it works now. You can use the TCPIP_STACK_NetIsReady() call rather than a counter. |
|
|
|
只有小组成员才能发言,加入小组>>
5160 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2225 浏览 5 评论
727浏览 1评论
612浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
501浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
626浏览 0评论
524浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 01:52 , Processed in 1.464828 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号