HI All I am newbie to using socket in R. I wrote the function below in R for Windows. The strange behavior is that each time I call this function R seems to hang for I don't know what reason. If I give at prompt line by line the commands below everything is fine: connection happens immediately, and also reading data from the socket with valid data. If I pack these line into a function R starts freezing, connection doesn't occurr immediately and so the following reading from the socket. The very strange thing is that this weird behavior goes away once I remove the read.socket calls. If there are not present; when I do this the connection happens immediately, but with read.sockect everything hangs. Can you help me? Thanks TestConnect<-function(){ print ( "start" ) aClient=make.socket( host="1.2.3.4", 11111, fail=TRUE, server=FALSE ) on.exit(close.socket(aClient)) print( "connected" ) data = read.socket( aClient, loop=FALSE ) print ( "read" ) print( data ) data = read.socket( aClient, loop=FALSE ) print ( "read" ) print( data ) } -- View this message in context: http://n4.nabble.com/reading-socket-hangs-tp1560083p1560083.html Sent from the R help mailing list archive at Nabble.com.