Home > Ask the AS/400 Experts > iSeries PC/Windows Connectivity Questions & Answers > Communicate with a Windows 2000 server via Socket connection
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Communicate with a Windows 2000 server via Socket connection

Shahar Mor EXPERT RESPONSE FROM: Shahar Mor

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 24 January 2005
I'm trying to communicate with a Windows 2000 server via Socket connection. I am able to connect, but when it comes to writing a record to the Socket, the person never see it and when I read for a response the connecton hangs for a long time, but I eventually get the message that I was disconnected by the remote Socket. Here is my code:
 
C                   Eval      sd=socket(AF_INET: SOCK_STREAM: 0)    
 *                                                                  
------------ 15 data records excluded ------------------------------
C                   Eval      serveraddr=*allx'00'                  
C                   Eval      sin_family=AF_INET                    
                                                                    
C                   Move      W1ServPortx   Servport                
C                   Move      W1ServAddrx   ServerParm              
C                   Eval      sin_port=SERVPORT                     
C                   Eval      SERVERParm=%trim(SERVERParm) + x'00'  
                                                                    
C                   Eval      sin_addr = inet_addr(ServerParm)      
------------ 26 data records excluded ------------------------------
C                   Eval      rc=connect(sd:                        
C                                        %addr(serveraddr):         
C                                        %size(serveraddr))         
------------ 43 data records excluded ------------------------------
C                   Eval      rc=send(sd: %addr(SocketData)         
C                                         :SockDtaLen:0)    
------------ 11 data records excluded ----------------------
C                   Eval      rc=recv(sd: %addr(SocketData):
C                                         SockDtaLen:0)     

Any guidance is appreciated.



Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
iSeries PC/Windows Connectivity
Remove character limits from domain or users on RMTUSER
Generically send a text file from the IFS via FTP
Send parameters correctly to the browser when creating a PHP page
Automate Client Access to find files on Windows scheduler
Setting ILE and C+++ compilers to runtime
Configuring Exchange server to allow mail forwarding from AS/400
Saving multiple sessions on IBM iSeries Client Access when using Vista
Use a virtual directory to move a .bmp file from the IFS to a remote server to run a software package
Displaying an image from the AS/400 on a PC, troubleshooting
Running a job on the iSeries after it has been transferred to a PC

Physical connections to iSeries
Configure the iSeries v5r4 to open the HTTPS port for incoming connections
"Time" saving programming tips for iSeries
PC/Windows connectivity: Top 10 expert Q&As
Run command on a PC
Working with ODBC and dates
Why is my job taking twice as long?
Problems with new server and PC
Take control of your iSeries network security -- Part 2
The iSeries and MS Office make good partners
Microsoft computing: Integrating the iSeries and Microsoft Office
Physical connections to iSeries Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


Your code looks OK, however, some things need to be checked.

1. What is the return code from the send API? The return code should be the length of the data you sent.

2. Did you translate the EBCDIC string to ASCII before sending? If data was sent in EBCDIC it can make problems to the windows program that will get the "strange character."

3. Did you make sure that the sockdtalen is correct? sockdtalen is the length of structure you sent.

4. It is not surprising that the receive is blocked because the remote windows program probably did not send data to you.

5. Please note that some of the problems may be the remote program "fault", try to test the remote program by using one of the socket tools available.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Visit the ITKnowledge Exchange and get answers to your connectivity questions fast.

The Best Web Links: Tips, tutorials and more.

PC/Windows connectivity expert Shahar Mor is available to answer your toughest networking questions. Ask Shahar a question or read his previously answered questions here.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts